{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "99bba62b",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "import pandas_profiling as pp \n",
    "import matplotlib.pyplot as plt\n",
    "import seaborn as sns\n",
    "import matplotlib\n",
    "\n",
    "#全部行都能输出\n",
    "from IPython.core.interactiveshell import InteractiveShell\n",
    "InteractiveShell.ast_node_interactivity = \"all\"\n",
    "matplotlib.use('TkAgg')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "d2cf583c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>station</th>\n",
       "      <th>Date</th>\n",
       "      <th>Present_Tmax</th>\n",
       "      <th>Present_Tmin</th>\n",
       "      <th>LDAPS_RHmin</th>\n",
       "      <th>LDAPS_RHmax</th>\n",
       "      <th>LDAPS_Tmax_lapse</th>\n",
       "      <th>LDAPS_Tmin_lapse</th>\n",
       "      <th>LDAPS_WS</th>\n",
       "      <th>LDAPS_LH</th>\n",
       "      <th>...</th>\n",
       "      <th>LDAPS_PPT2</th>\n",
       "      <th>LDAPS_PPT3</th>\n",
       "      <th>LDAPS_PPT4</th>\n",
       "      <th>lat</th>\n",
       "      <th>lon</th>\n",
       "      <th>DEM</th>\n",
       "      <th>Slope</th>\n",
       "      <th>Solar radiation</th>\n",
       "      <th>Next_Tmax</th>\n",
       "      <th>Next_Tmin</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1.0</td>\n",
       "      <td>6/30/2013</td>\n",
       "      <td>28.7</td>\n",
       "      <td>21.4</td>\n",
       "      <td>58.255688</td>\n",
       "      <td>91.116364</td>\n",
       "      <td>28.074101</td>\n",
       "      <td>23.006936</td>\n",
       "      <td>6.818887</td>\n",
       "      <td>69.451805</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>37.6046</td>\n",
       "      <td>126.991</td>\n",
       "      <td>212.3350</td>\n",
       "      <td>2.7850</td>\n",
       "      <td>5992.895996</td>\n",
       "      <td>29.1</td>\n",
       "      <td>21.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2.0</td>\n",
       "      <td>6/30/2013</td>\n",
       "      <td>31.9</td>\n",
       "      <td>21.6</td>\n",
       "      <td>52.263397</td>\n",
       "      <td>90.604721</td>\n",
       "      <td>29.850689</td>\n",
       "      <td>24.035009</td>\n",
       "      <td>5.691890</td>\n",
       "      <td>51.937448</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>37.6046</td>\n",
       "      <td>127.032</td>\n",
       "      <td>44.7624</td>\n",
       "      <td>0.5141</td>\n",
       "      <td>5869.312500</td>\n",
       "      <td>30.5</td>\n",
       "      <td>22.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3.0</td>\n",
       "      <td>6/30/2013</td>\n",
       "      <td>31.6</td>\n",
       "      <td>23.3</td>\n",
       "      <td>48.690479</td>\n",
       "      <td>83.973587</td>\n",
       "      <td>30.091292</td>\n",
       "      <td>24.565633</td>\n",
       "      <td>6.138224</td>\n",
       "      <td>20.573050</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>37.5776</td>\n",
       "      <td>127.058</td>\n",
       "      <td>33.3068</td>\n",
       "      <td>0.2661</td>\n",
       "      <td>5863.555664</td>\n",
       "      <td>31.1</td>\n",
       "      <td>23.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4.0</td>\n",
       "      <td>6/30/2013</td>\n",
       "      <td>32.0</td>\n",
       "      <td>23.4</td>\n",
       "      <td>58.239788</td>\n",
       "      <td>96.483688</td>\n",
       "      <td>29.704629</td>\n",
       "      <td>23.326177</td>\n",
       "      <td>5.650050</td>\n",
       "      <td>65.727144</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>37.6450</td>\n",
       "      <td>127.022</td>\n",
       "      <td>45.7160</td>\n",
       "      <td>2.5348</td>\n",
       "      <td>5856.964844</td>\n",
       "      <td>31.7</td>\n",
       "      <td>24.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5.0</td>\n",
       "      <td>6/30/2013</td>\n",
       "      <td>31.4</td>\n",
       "      <td>21.9</td>\n",
       "      <td>56.174095</td>\n",
       "      <td>90.155128</td>\n",
       "      <td>29.113934</td>\n",
       "      <td>23.486480</td>\n",
       "      <td>5.735004</td>\n",
       "      <td>107.965535</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>37.5507</td>\n",
       "      <td>127.135</td>\n",
       "      <td>35.0380</td>\n",
       "      <td>0.5055</td>\n",
       "      <td>5859.552246</td>\n",
       "      <td>31.2</td>\n",
       "      <td>22.5</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 25 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "   station       Date  Present_Tmax  Present_Tmin  LDAPS_RHmin  LDAPS_RHmax  \\\n",
       "0      1.0  6/30/2013          28.7          21.4    58.255688    91.116364   \n",
       "1      2.0  6/30/2013          31.9          21.6    52.263397    90.604721   \n",
       "2      3.0  6/30/2013          31.6          23.3    48.690479    83.973587   \n",
       "3      4.0  6/30/2013          32.0          23.4    58.239788    96.483688   \n",
       "4      5.0  6/30/2013          31.4          21.9    56.174095    90.155128   \n",
       "\n",
       "   LDAPS_Tmax_lapse  LDAPS_Tmin_lapse  LDAPS_WS    LDAPS_LH  ...  LDAPS_PPT2  \\\n",
       "0         28.074101         23.006936  6.818887   69.451805  ...         0.0   \n",
       "1         29.850689         24.035009  5.691890   51.937448  ...         0.0   \n",
       "2         30.091292         24.565633  6.138224   20.573050  ...         0.0   \n",
       "3         29.704629         23.326177  5.650050   65.727144  ...         0.0   \n",
       "4         29.113934         23.486480  5.735004  107.965535  ...         0.0   \n",
       "\n",
       "   LDAPS_PPT3  LDAPS_PPT4      lat      lon       DEM   Slope  \\\n",
       "0         0.0         0.0  37.6046  126.991  212.3350  2.7850   \n",
       "1         0.0         0.0  37.6046  127.032   44.7624  0.5141   \n",
       "2         0.0         0.0  37.5776  127.058   33.3068  0.2661   \n",
       "3         0.0         0.0  37.6450  127.022   45.7160  2.5348   \n",
       "4         0.0         0.0  37.5507  127.135   35.0380  0.5055   \n",
       "\n",
       "   Solar radiation  Next_Tmax  Next_Tmin  \n",
       "0      5992.895996       29.1       21.2  \n",
       "1      5869.312500       30.5       22.5  \n",
       "2      5863.555664       31.1       23.9  \n",
       "3      5856.964844       31.7       24.3  \n",
       "4      5859.552246       31.2       22.5  \n",
       "\n",
       "[5 rows x 25 columns]"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Data = pd.read_csv(r\"Dataset.csv\")\n",
    "Data.head() "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "ae016c1e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>station</th>\n",
       "      <th>Present_Tmax</th>\n",
       "      <th>Present_Tmin</th>\n",
       "      <th>LDAPS_RHmin</th>\n",
       "      <th>LDAPS_RHmax</th>\n",
       "      <th>LDAPS_Tmax_lapse</th>\n",
       "      <th>LDAPS_Tmin_lapse</th>\n",
       "      <th>LDAPS_WS</th>\n",
       "      <th>LDAPS_LH</th>\n",
       "      <th>LDAPS_CC1</th>\n",
       "      <th>...</th>\n",
       "      <th>LDAPS_PPT2</th>\n",
       "      <th>LDAPS_PPT3</th>\n",
       "      <th>LDAPS_PPT4</th>\n",
       "      <th>lat</th>\n",
       "      <th>lon</th>\n",
       "      <th>DEM</th>\n",
       "      <th>Slope</th>\n",
       "      <th>Solar radiation</th>\n",
       "      <th>Next_Tmax</th>\n",
       "      <th>Next_Tmin</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>7750.000000</td>\n",
       "      <td>7682.000000</td>\n",
       "      <td>7682.000000</td>\n",
       "      <td>7677.000000</td>\n",
       "      <td>7677.000000</td>\n",
       "      <td>7677.000000</td>\n",
       "      <td>7677.000000</td>\n",
       "      <td>7677.000000</td>\n",
       "      <td>7677.000000</td>\n",
       "      <td>7677.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>7677.000000</td>\n",
       "      <td>7677.000000</td>\n",
       "      <td>7677.000000</td>\n",
       "      <td>7752.000000</td>\n",
       "      <td>7752.000000</td>\n",
       "      <td>7752.000000</td>\n",
       "      <td>7752.000000</td>\n",
       "      <td>7752.000000</td>\n",
       "      <td>7725.000000</td>\n",
       "      <td>7725.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>13.000000</td>\n",
       "      <td>29.768211</td>\n",
       "      <td>23.225059</td>\n",
       "      <td>56.759372</td>\n",
       "      <td>88.374804</td>\n",
       "      <td>29.613447</td>\n",
       "      <td>23.512589</td>\n",
       "      <td>7.097875</td>\n",
       "      <td>62.505019</td>\n",
       "      <td>0.368774</td>\n",
       "      <td>...</td>\n",
       "      <td>0.485003</td>\n",
       "      <td>0.278200</td>\n",
       "      <td>0.269407</td>\n",
       "      <td>37.544722</td>\n",
       "      <td>126.991397</td>\n",
       "      <td>61.867972</td>\n",
       "      <td>1.257048</td>\n",
       "      <td>5341.502803</td>\n",
       "      <td>30.274887</td>\n",
       "      <td>22.932220</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>7.211568</td>\n",
       "      <td>2.969999</td>\n",
       "      <td>2.413961</td>\n",
       "      <td>14.668111</td>\n",
       "      <td>7.192004</td>\n",
       "      <td>2.947191</td>\n",
       "      <td>2.345347</td>\n",
       "      <td>2.183836</td>\n",
       "      <td>33.730589</td>\n",
       "      <td>0.262458</td>\n",
       "      <td>...</td>\n",
       "      <td>1.762807</td>\n",
       "      <td>1.161809</td>\n",
       "      <td>1.206214</td>\n",
       "      <td>0.050352</td>\n",
       "      <td>0.079435</td>\n",
       "      <td>54.279780</td>\n",
       "      <td>1.370444</td>\n",
       "      <td>429.158867</td>\n",
       "      <td>3.128010</td>\n",
       "      <td>2.487613</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>1.000000</td>\n",
       "      <td>20.000000</td>\n",
       "      <td>11.300000</td>\n",
       "      <td>19.794666</td>\n",
       "      <td>58.936283</td>\n",
       "      <td>17.624954</td>\n",
       "      <td>14.272646</td>\n",
       "      <td>2.882580</td>\n",
       "      <td>-13.603212</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>37.456200</td>\n",
       "      <td>126.826000</td>\n",
       "      <td>12.370000</td>\n",
       "      <td>0.098475</td>\n",
       "      <td>4329.520508</td>\n",
       "      <td>17.400000</td>\n",
       "      <td>11.300000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>7.000000</td>\n",
       "      <td>27.800000</td>\n",
       "      <td>21.700000</td>\n",
       "      <td>45.963543</td>\n",
       "      <td>84.222862</td>\n",
       "      <td>27.673499</td>\n",
       "      <td>22.089739</td>\n",
       "      <td>5.678705</td>\n",
       "      <td>37.266753</td>\n",
       "      <td>0.146654</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>37.510200</td>\n",
       "      <td>126.937000</td>\n",
       "      <td>28.700000</td>\n",
       "      <td>0.271300</td>\n",
       "      <td>4999.018555</td>\n",
       "      <td>28.200000</td>\n",
       "      <td>21.300000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>13.000000</td>\n",
       "      <td>29.900000</td>\n",
       "      <td>23.400000</td>\n",
       "      <td>55.039024</td>\n",
       "      <td>89.793480</td>\n",
       "      <td>29.703426</td>\n",
       "      <td>23.760199</td>\n",
       "      <td>6.547470</td>\n",
       "      <td>56.865482</td>\n",
       "      <td>0.315697</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>37.550700</td>\n",
       "      <td>126.995000</td>\n",
       "      <td>45.716000</td>\n",
       "      <td>0.618000</td>\n",
       "      <td>5436.345215</td>\n",
       "      <td>30.500000</td>\n",
       "      <td>23.100000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>19.000000</td>\n",
       "      <td>32.000000</td>\n",
       "      <td>24.900000</td>\n",
       "      <td>67.190056</td>\n",
       "      <td>93.743629</td>\n",
       "      <td>31.710450</td>\n",
       "      <td>25.152909</td>\n",
       "      <td>8.032276</td>\n",
       "      <td>84.223616</td>\n",
       "      <td>0.575489</td>\n",
       "      <td>...</td>\n",
       "      <td>0.018364</td>\n",
       "      <td>0.007896</td>\n",
       "      <td>0.000041</td>\n",
       "      <td>37.577600</td>\n",
       "      <td>127.042000</td>\n",
       "      <td>59.832400</td>\n",
       "      <td>1.767800</td>\n",
       "      <td>5728.316406</td>\n",
       "      <td>32.600000</td>\n",
       "      <td>24.600000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>25.000000</td>\n",
       "      <td>37.600000</td>\n",
       "      <td>29.900000</td>\n",
       "      <td>98.524734</td>\n",
       "      <td>100.000153</td>\n",
       "      <td>38.542255</td>\n",
       "      <td>29.619342</td>\n",
       "      <td>21.857621</td>\n",
       "      <td>213.414006</td>\n",
       "      <td>0.967277</td>\n",
       "      <td>...</td>\n",
       "      <td>21.621661</td>\n",
       "      <td>15.841235</td>\n",
       "      <td>16.655469</td>\n",
       "      <td>37.645000</td>\n",
       "      <td>127.135000</td>\n",
       "      <td>212.335000</td>\n",
       "      <td>5.178230</td>\n",
       "      <td>5992.895996</td>\n",
       "      <td>38.900000</td>\n",
       "      <td>29.800000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>8 rows × 24 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "           station  Present_Tmax  Present_Tmin  LDAPS_RHmin  LDAPS_RHmax  \\\n",
       "count  7750.000000   7682.000000   7682.000000  7677.000000  7677.000000   \n",
       "mean     13.000000     29.768211     23.225059    56.759372    88.374804   \n",
       "std       7.211568      2.969999      2.413961    14.668111     7.192004   \n",
       "min       1.000000     20.000000     11.300000    19.794666    58.936283   \n",
       "25%       7.000000     27.800000     21.700000    45.963543    84.222862   \n",
       "50%      13.000000     29.900000     23.400000    55.039024    89.793480   \n",
       "75%      19.000000     32.000000     24.900000    67.190056    93.743629   \n",
       "max      25.000000     37.600000     29.900000    98.524734   100.000153   \n",
       "\n",
       "       LDAPS_Tmax_lapse  LDAPS_Tmin_lapse     LDAPS_WS     LDAPS_LH  \\\n",
       "count       7677.000000       7677.000000  7677.000000  7677.000000   \n",
       "mean          29.613447         23.512589     7.097875    62.505019   \n",
       "std            2.947191          2.345347     2.183836    33.730589   \n",
       "min           17.624954         14.272646     2.882580   -13.603212   \n",
       "25%           27.673499         22.089739     5.678705    37.266753   \n",
       "50%           29.703426         23.760199     6.547470    56.865482   \n",
       "75%           31.710450         25.152909     8.032276    84.223616   \n",
       "max           38.542255         29.619342    21.857621   213.414006   \n",
       "\n",
       "         LDAPS_CC1  ...   LDAPS_PPT2   LDAPS_PPT3   LDAPS_PPT4          lat  \\\n",
       "count  7677.000000  ...  7677.000000  7677.000000  7677.000000  7752.000000   \n",
       "mean      0.368774  ...     0.485003     0.278200     0.269407    37.544722   \n",
       "std       0.262458  ...     1.762807     1.161809     1.206214     0.050352   \n",
       "min       0.000000  ...     0.000000     0.000000     0.000000    37.456200   \n",
       "25%       0.146654  ...     0.000000     0.000000     0.000000    37.510200   \n",
       "50%       0.315697  ...     0.000000     0.000000     0.000000    37.550700   \n",
       "75%       0.575489  ...     0.018364     0.007896     0.000041    37.577600   \n",
       "max       0.967277  ...    21.621661    15.841235    16.655469    37.645000   \n",
       "\n",
       "               lon          DEM        Slope  Solar radiation    Next_Tmax  \\\n",
       "count  7752.000000  7752.000000  7752.000000      7752.000000  7725.000000   \n",
       "mean    126.991397    61.867972     1.257048      5341.502803    30.274887   \n",
       "std       0.079435    54.279780     1.370444       429.158867     3.128010   \n",
       "min     126.826000    12.370000     0.098475      4329.520508    17.400000   \n",
       "25%     126.937000    28.700000     0.271300      4999.018555    28.200000   \n",
       "50%     126.995000    45.716000     0.618000      5436.345215    30.500000   \n",
       "75%     127.042000    59.832400     1.767800      5728.316406    32.600000   \n",
       "max     127.135000   212.335000     5.178230      5992.895996    38.900000   \n",
       "\n",
       "         Next_Tmin  \n",
       "count  7725.000000  \n",
       "mean     22.932220  \n",
       "std       2.487613  \n",
       "min      11.300000  \n",
       "25%      21.300000  \n",
       "50%      23.100000  \n",
       "75%      24.600000  \n",
       "max      29.800000  \n",
       "\n",
       "[8 rows x 24 columns]"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Data.describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "f0f0ffc3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "station              2\n",
       "Date                 2\n",
       "Present_Tmax        70\n",
       "Present_Tmin        70\n",
       "LDAPS_RHmin         75\n",
       "LDAPS_RHmax         75\n",
       "LDAPS_Tmax_lapse    75\n",
       "LDAPS_Tmin_lapse    75\n",
       "LDAPS_WS            75\n",
       "LDAPS_LH            75\n",
       "LDAPS_CC1           75\n",
       "LDAPS_CC2           75\n",
       "LDAPS_CC3           75\n",
       "LDAPS_CC4           75\n",
       "LDAPS_PPT1          75\n",
       "LDAPS_PPT2          75\n",
       "LDAPS_PPT3          75\n",
       "LDAPS_PPT4          75\n",
       "lat                  0\n",
       "lon                  0\n",
       "DEM                  0\n",
       "Slope                0\n",
       "Solar radiation      0\n",
       "Next_Tmax           27\n",
       "Next_Tmin           27\n",
       "dtype: int64"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Data.isna().sum() "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "86e69a1c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>station</th>\n",
       "      <th>Date</th>\n",
       "      <th>Present_Tmax</th>\n",
       "      <th>Present_Tmin</th>\n",
       "      <th>LDAPS_RHmin</th>\n",
       "      <th>LDAPS_RHmax</th>\n",
       "      <th>LDAPS_Tmax_lapse</th>\n",
       "      <th>LDAPS_Tmin_lapse</th>\n",
       "      <th>LDAPS_WS</th>\n",
       "      <th>LDAPS_LH</th>\n",
       "      <th>...</th>\n",
       "      <th>LDAPS_PPT2</th>\n",
       "      <th>LDAPS_PPT3</th>\n",
       "      <th>LDAPS_PPT4</th>\n",
       "      <th>lat</th>\n",
       "      <th>lon</th>\n",
       "      <th>DEM</th>\n",
       "      <th>Slope</th>\n",
       "      <th>Solar radiation</th>\n",
       "      <th>Next_Tmax</th>\n",
       "      <th>Next_Tmin</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>831</th>\n",
       "      <td>7.0</td>\n",
       "      <td>8/2/2013</td>\n",
       "      <td>29.6</td>\n",
       "      <td>25.8</td>\n",
       "      <td>76.202255</td>\n",
       "      <td>94.058517</td>\n",
       "      <td>28.842727</td>\n",
       "      <td>26.442801</td>\n",
       "      <td>7.980686</td>\n",
       "      <td>87.715882</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>37.5776</td>\n",
       "      <td>126.838</td>\n",
       "      <td>12.3700</td>\n",
       "      <td>0.0985</td>\n",
       "      <td>5357.705566</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>856</th>\n",
       "      <td>7.0</td>\n",
       "      <td>8/3/2013</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>69.476059</td>\n",
       "      <td>93.672600</td>\n",
       "      <td>30.491629</td>\n",
       "      <td>25.081388</td>\n",
       "      <td>6.282423</td>\n",
       "      <td>124.191446</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>37.5776</td>\n",
       "      <td>126.838</td>\n",
       "      <td>12.3700</td>\n",
       "      <td>0.0985</td>\n",
       "      <td>5332.515625</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1073</th>\n",
       "      <td>24.0</td>\n",
       "      <td>8/11/2013</td>\n",
       "      <td>34.2</td>\n",
       "      <td>25.1</td>\n",
       "      <td>50.618851</td>\n",
       "      <td>89.166397</td>\n",
       "      <td>33.414349</td>\n",
       "      <td>27.475249</td>\n",
       "      <td>6.084058</td>\n",
       "      <td>48.521008</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>37.5237</td>\n",
       "      <td>126.909</td>\n",
       "      <td>17.2956</td>\n",
       "      <td>0.2223</td>\n",
       "      <td>5109.454102</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2465</th>\n",
       "      <td>16.0</td>\n",
       "      <td>8/5/2014</td>\n",
       "      <td>28.8</td>\n",
       "      <td>23.1</td>\n",
       "      <td>71.442566</td>\n",
       "      <td>90.695419</td>\n",
       "      <td>26.273760</td>\n",
       "      <td>23.419080</td>\n",
       "      <td>3.787889</td>\n",
       "      <td>41.739802</td>\n",
       "      <td>...</td>\n",
       "      <td>0.010050</td>\n",
       "      <td>0.681801</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>37.4697</td>\n",
       "      <td>126.995</td>\n",
       "      <td>82.2912</td>\n",
       "      <td>2.2579</td>\n",
       "      <td>5269.604980</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3696</th>\n",
       "      <td>22.0</td>\n",
       "      <td>7/23/2015</td>\n",
       "      <td>30.4</td>\n",
       "      <td>23.4</td>\n",
       "      <td>81.568771</td>\n",
       "      <td>93.973579</td>\n",
       "      <td>26.724457</td>\n",
       "      <td>24.984435</td>\n",
       "      <td>5.779299</td>\n",
       "      <td>58.456456</td>\n",
       "      <td>...</td>\n",
       "      <td>0.711069</td>\n",
       "      <td>0.016985</td>\n",
       "      <td>0.064332</td>\n",
       "      <td>37.5102</td>\n",
       "      <td>127.086</td>\n",
       "      <td>21.9668</td>\n",
       "      <td>0.1332</td>\n",
       "      <td>5578.788086</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3714</th>\n",
       "      <td>15.0</td>\n",
       "      <td>7/24/2015</td>\n",
       "      <td>24.6</td>\n",
       "      <td>22.4</td>\n",
       "      <td>83.265244</td>\n",
       "      <td>94.153442</td>\n",
       "      <td>26.738321</td>\n",
       "      <td>24.585545</td>\n",
       "      <td>8.048991</td>\n",
       "      <td>43.391457</td>\n",
       "      <td>...</td>\n",
       "      <td>0.803824</td>\n",
       "      <td>0.190226</td>\n",
       "      <td>0.001864</td>\n",
       "      <td>37.5507</td>\n",
       "      <td>126.937</td>\n",
       "      <td>30.0464</td>\n",
       "      <td>0.8552</td>\n",
       "      <td>5578.187500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3739</th>\n",
       "      <td>15.0</td>\n",
       "      <td>7/25/2015</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>68.156593</td>\n",
       "      <td>93.874550</td>\n",
       "      <td>28.502294</td>\n",
       "      <td>24.270829</td>\n",
       "      <td>5.819343</td>\n",
       "      <td>35.236471</td>\n",
       "      <td>...</td>\n",
       "      <td>1.128825</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>37.5507</td>\n",
       "      <td>126.937</td>\n",
       "      <td>30.0464</td>\n",
       "      <td>0.8552</td>\n",
       "      <td>5558.664551</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3886</th>\n",
       "      <td>12.0</td>\n",
       "      <td>7/31/2015</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>64.559479</td>\n",
       "      <td>86.083702</td>\n",
       "      <td>29.628166</td>\n",
       "      <td>25.745189</td>\n",
       "      <td>8.629767</td>\n",
       "      <td>26.564901</td>\n",
       "      <td>...</td>\n",
       "      <td>0.020635</td>\n",
       "      <td>0.001050</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>37.5507</td>\n",
       "      <td>126.988</td>\n",
       "      <td>132.1180</td>\n",
       "      <td>0.5931</td>\n",
       "      <td>5477.556152</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4205</th>\n",
       "      <td>6.0</td>\n",
       "      <td>8/13/2015</td>\n",
       "      <td>30.8</td>\n",
       "      <td>23.9</td>\n",
       "      <td>35.218002</td>\n",
       "      <td>82.458534</td>\n",
       "      <td>32.241880</td>\n",
       "      <td>23.018172</td>\n",
       "      <td>6.547084</td>\n",
       "      <td>63.516243</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>37.5102</td>\n",
       "      <td>127.042</td>\n",
       "      <td>54.6384</td>\n",
       "      <td>0.1457</td>\n",
       "      <td>5069.704102</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4230</th>\n",
       "      <td>6.0</td>\n",
       "      <td>8/14/2015</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>43.412582</td>\n",
       "      <td>84.317780</td>\n",
       "      <td>32.028639</td>\n",
       "      <td>24.274533</td>\n",
       "      <td>5.880758</td>\n",
       "      <td>54.278856</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.007733</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>37.5102</td>\n",
       "      <td>127.042</td>\n",
       "      <td>54.6384</td>\n",
       "      <td>0.1457</td>\n",
       "      <td>5037.928223</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4255</th>\n",
       "      <td>6.0</td>\n",
       "      <td>8/15/2015</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>58.784390</td>\n",
       "      <td>79.509987</td>\n",
       "      <td>28.628288</td>\n",
       "      <td>24.045805</td>\n",
       "      <td>4.762958</td>\n",
       "      <td>50.826542</td>\n",
       "      <td>...</td>\n",
       "      <td>1.277620</td>\n",
       "      <td>0.002280</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>37.5102</td>\n",
       "      <td>127.042</td>\n",
       "      <td>54.6384</td>\n",
       "      <td>0.1457</td>\n",
       "      <td>5005.629395</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4280</th>\n",
       "      <td>6.0</td>\n",
       "      <td>8/16/2015</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>28.475870</td>\n",
       "      <td>89.183807</td>\n",
       "      <td>33.651696</td>\n",
       "      <td>21.381762</td>\n",
       "      <td>6.050666</td>\n",
       "      <td>61.250346</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>37.5102</td>\n",
       "      <td>127.042</td>\n",
       "      <td>54.6384</td>\n",
       "      <td>0.1457</td>\n",
       "      <td>4972.712891</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5656</th>\n",
       "      <td>7.0</td>\n",
       "      <td>8/9/2016</td>\n",
       "      <td>33.1</td>\n",
       "      <td>26.8</td>\n",
       "      <td>64.725151</td>\n",
       "      <td>90.769173</td>\n",
       "      <td>31.730979</td>\n",
       "      <td>26.316541</td>\n",
       "      <td>5.095636</td>\n",
       "      <td>127.601342</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>37.5776</td>\n",
       "      <td>126.838</td>\n",
       "      <td>12.3700</td>\n",
       "      <td>0.0985</td>\n",
       "      <td>5140.230957</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5681</th>\n",
       "      <td>7.0</td>\n",
       "      <td>8/10/2016</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>51.469501</td>\n",
       "      <td>88.160759</td>\n",
       "      <td>33.531711</td>\n",
       "      <td>27.066962</td>\n",
       "      <td>4.934146</td>\n",
       "      <td>139.353021</td>\n",
       "      <td>...</td>\n",
       "      <td>0.008194</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>37.5776</td>\n",
       "      <td>126.838</td>\n",
       "      <td>12.3700</td>\n",
       "      <td>0.0985</td>\n",
       "      <td>5110.264160</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6060</th>\n",
       "      <td>11.0</td>\n",
       "      <td>8/25/2016</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>44.908253</td>\n",
       "      <td>86.309982</td>\n",
       "      <td>26.065732</td>\n",
       "      <td>21.639797</td>\n",
       "      <td>9.656940</td>\n",
       "      <td>78.263273</td>\n",
       "      <td>...</td>\n",
       "      <td>0.152258</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>37.5372</td>\n",
       "      <td>127.085</td>\n",
       "      <td>28.7000</td>\n",
       "      <td>0.6233</td>\n",
       "      <td>4621.790527</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6268</th>\n",
       "      <td>19.0</td>\n",
       "      <td>7/2/2017</td>\n",
       "      <td>25.6</td>\n",
       "      <td>21.7</td>\n",
       "      <td>84.423805</td>\n",
       "      <td>99.652794</td>\n",
       "      <td>24.881373</td>\n",
       "      <td>22.821416</td>\n",
       "      <td>9.236040</td>\n",
       "      <td>41.559663</td>\n",
       "      <td>...</td>\n",
       "      <td>11.237815</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.025666</td>\n",
       "      <td>37.5776</td>\n",
       "      <td>126.938</td>\n",
       "      <td>75.0924</td>\n",
       "      <td>1.7678</td>\n",
       "      <td>5882.380371</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6357</th>\n",
       "      <td>8.0</td>\n",
       "      <td>7/6/2017</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>77.332268</td>\n",
       "      <td>89.395378</td>\n",
       "      <td>27.467565</td>\n",
       "      <td>24.160557</td>\n",
       "      <td>7.628294</td>\n",
       "      <td>38.808770</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.202485</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>37.4697</td>\n",
       "      <td>126.910</td>\n",
       "      <td>52.5180</td>\n",
       "      <td>1.5629</td>\n",
       "      <td>5822.300781</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6435</th>\n",
       "      <td>11.0</td>\n",
       "      <td>7/9/2017</td>\n",
       "      <td>28.8</td>\n",
       "      <td>24.5</td>\n",
       "      <td>77.014175</td>\n",
       "      <td>90.517715</td>\n",
       "      <td>28.321989</td>\n",
       "      <td>24.563500</td>\n",
       "      <td>10.349091</td>\n",
       "      <td>53.364445</td>\n",
       "      <td>...</td>\n",
       "      <td>0.049561</td>\n",
       "      <td>0.073857</td>\n",
       "      <td>0.013500</td>\n",
       "      <td>37.5372</td>\n",
       "      <td>127.085</td>\n",
       "      <td>28.7000</td>\n",
       "      <td>0.6233</td>\n",
       "      <td>5795.268066</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6907</th>\n",
       "      <td>8.0</td>\n",
       "      <td>7/28/2017</td>\n",
       "      <td>27.5</td>\n",
       "      <td>24.3</td>\n",
       "      <td>54.392185</td>\n",
       "      <td>88.281052</td>\n",
       "      <td>30.742290</td>\n",
       "      <td>25.195872</td>\n",
       "      <td>6.311136</td>\n",
       "      <td>44.619934</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>37.4697</td>\n",
       "      <td>126.910</td>\n",
       "      <td>52.5180</td>\n",
       "      <td>1.5629</td>\n",
       "      <td>5483.880859</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7254</th>\n",
       "      <td>5.0</td>\n",
       "      <td>8/11/2017</td>\n",
       "      <td>30.9</td>\n",
       "      <td>23.3</td>\n",
       "      <td>51.226562</td>\n",
       "      <td>85.210350</td>\n",
       "      <td>30.742346</td>\n",
       "      <td>23.130362</td>\n",
       "      <td>5.471810</td>\n",
       "      <td>138.030061</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>37.5507</td>\n",
       "      <td>127.135</td>\n",
       "      <td>35.0380</td>\n",
       "      <td>0.5055</td>\n",
       "      <td>5117.593750</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7304</th>\n",
       "      <td>5.0</td>\n",
       "      <td>8/13/2017</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>73.782753</td>\n",
       "      <td>85.662842</td>\n",
       "      <td>25.370156</td>\n",
       "      <td>21.846991</td>\n",
       "      <td>7.367599</td>\n",
       "      <td>72.823796</td>\n",
       "      <td>...</td>\n",
       "      <td>0.038970</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.001464</td>\n",
       "      <td>37.5507</td>\n",
       "      <td>127.135</td>\n",
       "      <td>35.0380</td>\n",
       "      <td>0.5055</td>\n",
       "      <td>5055.825195</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7344</th>\n",
       "      <td>20.0</td>\n",
       "      <td>8/14/2017</td>\n",
       "      <td>26.2</td>\n",
       "      <td>22.1</td>\n",
       "      <td>85.103630</td>\n",
       "      <td>98.765335</td>\n",
       "      <td>21.925545</td>\n",
       "      <td>19.703742</td>\n",
       "      <td>14.541317</td>\n",
       "      <td>45.193849</td>\n",
       "      <td>...</td>\n",
       "      <td>3.044013</td>\n",
       "      <td>9.856375</td>\n",
       "      <td>6.913979</td>\n",
       "      <td>37.6181</td>\n",
       "      <td>127.004</td>\n",
       "      <td>146.5540</td>\n",
       "      <td>4.7296</td>\n",
       "      <td>5122.638184</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7504</th>\n",
       "      <td>5.0</td>\n",
       "      <td>8/21/2017</td>\n",
       "      <td>27.7</td>\n",
       "      <td>23.3</td>\n",
       "      <td>53.629204</td>\n",
       "      <td>94.092056</td>\n",
       "      <td>30.448380</td>\n",
       "      <td>24.038216</td>\n",
       "      <td>5.289254</td>\n",
       "      <td>114.941728</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>37.5507</td>\n",
       "      <td>127.135</td>\n",
       "      <td>35.0380</td>\n",
       "      <td>0.5055</td>\n",
       "      <td>4786.577637</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7554</th>\n",
       "      <td>5.0</td>\n",
       "      <td>8/23/2017</td>\n",
       "      <td>30.7</td>\n",
       "      <td>23.7</td>\n",
       "      <td>78.330040</td>\n",
       "      <td>91.991310</td>\n",
       "      <td>28.959303</td>\n",
       "      <td>24.378045</td>\n",
       "      <td>12.264002</td>\n",
       "      <td>76.349382</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>2.064935</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>37.5507</td>\n",
       "      <td>127.135</td>\n",
       "      <td>35.0380</td>\n",
       "      <td>0.5055</td>\n",
       "      <td>4714.059570</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7571</th>\n",
       "      <td>22.0</td>\n",
       "      <td>8/23/2017</td>\n",
       "      <td>30.2</td>\n",
       "      <td>24.9</td>\n",
       "      <td>76.936493</td>\n",
       "      <td>90.509560</td>\n",
       "      <td>29.339601</td>\n",
       "      <td>24.659223</td>\n",
       "      <td>11.588554</td>\n",
       "      <td>78.099351</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>2.665117</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>37.5102</td>\n",
       "      <td>127.086</td>\n",
       "      <td>21.9668</td>\n",
       "      <td>0.1332</td>\n",
       "      <td>4709.788086</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7604</th>\n",
       "      <td>5.0</td>\n",
       "      <td>8/25/2017</td>\n",
       "      <td>30.3</td>\n",
       "      <td>21.7</td>\n",
       "      <td>35.563965</td>\n",
       "      <td>88.866699</td>\n",
       "      <td>28.262768</td>\n",
       "      <td>19.288583</td>\n",
       "      <td>5.651513</td>\n",
       "      <td>146.119220</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>37.5507</td>\n",
       "      <td>127.135</td>\n",
       "      <td>35.0380</td>\n",
       "      <td>0.5055</td>\n",
       "      <td>4640.095215</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7682</th>\n",
       "      <td>8.0</td>\n",
       "      <td>8/28/2017</td>\n",
       "      <td>26.3</td>\n",
       "      <td>18.1</td>\n",
       "      <td>29.959215</td>\n",
       "      <td>90.116638</td>\n",
       "      <td>23.135079</td>\n",
       "      <td>17.282587</td>\n",
       "      <td>9.292264</td>\n",
       "      <td>75.430868</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>37.4697</td>\n",
       "      <td>126.910</td>\n",
       "      <td>52.5180</td>\n",
       "      <td>1.5629</td>\n",
       "      <td>4518.488770</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>27 rows × 25 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      station       Date  Present_Tmax  Present_Tmin  LDAPS_RHmin  \\\n",
       "831       7.0   8/2/2013          29.6          25.8    76.202255   \n",
       "856       7.0   8/3/2013           NaN           NaN    69.476059   \n",
       "1073     24.0  8/11/2013          34.2          25.1    50.618851   \n",
       "2465     16.0   8/5/2014          28.8          23.1    71.442566   \n",
       "3696     22.0  7/23/2015          30.4          23.4    81.568771   \n",
       "3714     15.0  7/24/2015          24.6          22.4    83.265244   \n",
       "3739     15.0  7/25/2015           NaN           NaN    68.156593   \n",
       "3886     12.0  7/31/2015           NaN           NaN    64.559479   \n",
       "4205      6.0  8/13/2015          30.8          23.9    35.218002   \n",
       "4230      6.0  8/14/2015           NaN           NaN    43.412582   \n",
       "4255      6.0  8/15/2015           NaN           NaN    58.784390   \n",
       "4280      6.0  8/16/2015           NaN           NaN    28.475870   \n",
       "5656      7.0   8/9/2016          33.1          26.8    64.725151   \n",
       "5681      7.0  8/10/2016           NaN           NaN    51.469501   \n",
       "6060     11.0  8/25/2016           NaN           NaN    44.908253   \n",
       "6268     19.0   7/2/2017          25.6          21.7    84.423805   \n",
       "6357      8.0   7/6/2017           NaN           NaN    77.332268   \n",
       "6435     11.0   7/9/2017          28.8          24.5    77.014175   \n",
       "6907      8.0  7/28/2017          27.5          24.3    54.392185   \n",
       "7254      5.0  8/11/2017          30.9          23.3    51.226562   \n",
       "7304      5.0  8/13/2017           NaN           NaN    73.782753   \n",
       "7344     20.0  8/14/2017          26.2          22.1    85.103630   \n",
       "7504      5.0  8/21/2017          27.7          23.3    53.629204   \n",
       "7554      5.0  8/23/2017          30.7          23.7    78.330040   \n",
       "7571     22.0  8/23/2017          30.2          24.9    76.936493   \n",
       "7604      5.0  8/25/2017          30.3          21.7    35.563965   \n",
       "7682      8.0  8/28/2017          26.3          18.1    29.959215   \n",
       "\n",
       "      LDAPS_RHmax  LDAPS_Tmax_lapse  LDAPS_Tmin_lapse   LDAPS_WS    LDAPS_LH  \\\n",
       "831     94.058517         28.842727         26.442801   7.980686   87.715882   \n",
       "856     93.672600         30.491629         25.081388   6.282423  124.191446   \n",
       "1073    89.166397         33.414349         27.475249   6.084058   48.521008   \n",
       "2465    90.695419         26.273760         23.419080   3.787889   41.739802   \n",
       "3696    93.973579         26.724457         24.984435   5.779299   58.456456   \n",
       "3714    94.153442         26.738321         24.585545   8.048991   43.391457   \n",
       "3739    93.874550         28.502294         24.270829   5.819343   35.236471   \n",
       "3886    86.083702         29.628166         25.745189   8.629767   26.564901   \n",
       "4205    82.458534         32.241880         23.018172   6.547084   63.516243   \n",
       "4230    84.317780         32.028639         24.274533   5.880758   54.278856   \n",
       "4255    79.509987         28.628288         24.045805   4.762958   50.826542   \n",
       "4280    89.183807         33.651696         21.381762   6.050666   61.250346   \n",
       "5656    90.769173         31.730979         26.316541   5.095636  127.601342   \n",
       "5681    88.160759         33.531711         27.066962   4.934146  139.353021   \n",
       "6060    86.309982         26.065732         21.639797   9.656940   78.263273   \n",
       "6268    99.652794         24.881373         22.821416   9.236040   41.559663   \n",
       "6357    89.395378         27.467565         24.160557   7.628294   38.808770   \n",
       "6435    90.517715         28.321989         24.563500  10.349091   53.364445   \n",
       "6907    88.281052         30.742290         25.195872   6.311136   44.619934   \n",
       "7254    85.210350         30.742346         23.130362   5.471810  138.030061   \n",
       "7304    85.662842         25.370156         21.846991   7.367599   72.823796   \n",
       "7344    98.765335         21.925545         19.703742  14.541317   45.193849   \n",
       "7504    94.092056         30.448380         24.038216   5.289254  114.941728   \n",
       "7554    91.991310         28.959303         24.378045  12.264002   76.349382   \n",
       "7571    90.509560         29.339601         24.659223  11.588554   78.099351   \n",
       "7604    88.866699         28.262768         19.288583   5.651513  146.119220   \n",
       "7682    90.116638         23.135079         17.282587   9.292264   75.430868   \n",
       "\n",
       "      ...  LDAPS_PPT2  LDAPS_PPT3  LDAPS_PPT4      lat      lon       DEM  \\\n",
       "831   ...    0.000000    0.000000    0.000000  37.5776  126.838   12.3700   \n",
       "856   ...    0.000000    0.000000    0.000000  37.5776  126.838   12.3700   \n",
       "1073  ...    0.000000    0.000000    0.000000  37.5237  126.909   17.2956   \n",
       "2465  ...    0.010050    0.681801    0.000000  37.4697  126.995   82.2912   \n",
       "3696  ...    0.711069    0.016985    0.064332  37.5102  127.086   21.9668   \n",
       "3714  ...    0.803824    0.190226    0.001864  37.5507  126.937   30.0464   \n",
       "3739  ...    1.128825    0.000000    0.000000  37.5507  126.937   30.0464   \n",
       "3886  ...    0.020635    0.001050    0.000000  37.5507  126.988  132.1180   \n",
       "4205  ...    0.000000    0.000000    0.000000  37.5102  127.042   54.6384   \n",
       "4230  ...    0.000000    0.007733    0.000000  37.5102  127.042   54.6384   \n",
       "4255  ...    1.277620    0.002280    0.000000  37.5102  127.042   54.6384   \n",
       "4280  ...    0.000000    0.000000    0.000000  37.5102  127.042   54.6384   \n",
       "5656  ...    0.000000    0.000000    0.000000  37.5776  126.838   12.3700   \n",
       "5681  ...    0.008194    0.000000    0.000000  37.5776  126.838   12.3700   \n",
       "6060  ...    0.152258    0.000000    0.000000  37.5372  127.085   28.7000   \n",
       "6268  ...   11.237815    0.000000    0.025666  37.5776  126.938   75.0924   \n",
       "6357  ...    0.000000    0.202485    0.000000  37.4697  126.910   52.5180   \n",
       "6435  ...    0.049561    0.073857    0.013500  37.5372  127.085   28.7000   \n",
       "6907  ...    0.000000    0.000000    0.000000  37.4697  126.910   52.5180   \n",
       "7254  ...    0.000000    0.000000    0.000000  37.5507  127.135   35.0380   \n",
       "7304  ...    0.038970    0.000000    0.001464  37.5507  127.135   35.0380   \n",
       "7344  ...    3.044013    9.856375    6.913979  37.6181  127.004  146.5540   \n",
       "7504  ...    0.000000    0.000000    0.000000  37.5507  127.135   35.0380   \n",
       "7554  ...    0.000000    2.064935    0.000000  37.5507  127.135   35.0380   \n",
       "7571  ...    0.000000    2.665117    0.000000  37.5102  127.086   21.9668   \n",
       "7604  ...    0.000000    0.000000    0.000000  37.5507  127.135   35.0380   \n",
       "7682  ...    0.000000    0.000000    0.000000  37.4697  126.910   52.5180   \n",
       "\n",
       "       Slope  Solar radiation  Next_Tmax  Next_Tmin  \n",
       "831   0.0985      5357.705566        NaN        NaN  \n",
       "856   0.0985      5332.515625        NaN        NaN  \n",
       "1073  0.2223      5109.454102        NaN        NaN  \n",
       "2465  2.2579      5269.604980        NaN        NaN  \n",
       "3696  0.1332      5578.788086        NaN        NaN  \n",
       "3714  0.8552      5578.187500        NaN        NaN  \n",
       "3739  0.8552      5558.664551        NaN        NaN  \n",
       "3886  0.5931      5477.556152        NaN        NaN  \n",
       "4205  0.1457      5069.704102        NaN        NaN  \n",
       "4230  0.1457      5037.928223        NaN        NaN  \n",
       "4255  0.1457      5005.629395        NaN        NaN  \n",
       "4280  0.1457      4972.712891        NaN        NaN  \n",
       "5656  0.0985      5140.230957        NaN        NaN  \n",
       "5681  0.0985      5110.264160        NaN        NaN  \n",
       "6060  0.6233      4621.790527        NaN        NaN  \n",
       "6268  1.7678      5882.380371        NaN        NaN  \n",
       "6357  1.5629      5822.300781        NaN        NaN  \n",
       "6435  0.6233      5795.268066        NaN        NaN  \n",
       "6907  1.5629      5483.880859        NaN        NaN  \n",
       "7254  0.5055      5117.593750        NaN        NaN  \n",
       "7304  0.5055      5055.825195        NaN        NaN  \n",
       "7344  4.7296      5122.638184        NaN        NaN  \n",
       "7504  0.5055      4786.577637        NaN        NaN  \n",
       "7554  0.5055      4714.059570        NaN        NaN  \n",
       "7571  0.1332      4709.788086        NaN        NaN  \n",
       "7604  0.5055      4640.095215        NaN        NaN  \n",
       "7682  1.5629      4518.488770        NaN        NaN  \n",
       "\n",
       "[27 rows x 25 columns]"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 取出所有有空值的记录  （5分）\n",
    "for i in Data.columns:\n",
    "    ane=Data[Data[i].isna()]  \n",
    "ane"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "030bed6d",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\seaborn\\distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).\n",
      "  warnings.warn(msg, FutureWarning)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:xlabel='station', ylabel='Density'>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\seaborn\\distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).\n",
      "  warnings.warn(msg, FutureWarning)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:xlabel='Present_Tmax', ylabel='Density'>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\seaborn\\distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).\n",
      "  warnings.warn(msg, FutureWarning)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:xlabel='Present_Tmin', ylabel='Density'>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\seaborn\\distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).\n",
      "  warnings.warn(msg, FutureWarning)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:xlabel='LDAPS_RHmin', ylabel='Density'>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\seaborn\\distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).\n",
      "  warnings.warn(msg, FutureWarning)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:xlabel='LDAPS_RHmax', ylabel='Density'>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\seaborn\\distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).\n",
      "  warnings.warn(msg, FutureWarning)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:xlabel='LDAPS_Tmax_lapse', ylabel='Density'>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\seaborn\\distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).\n",
      "  warnings.warn(msg, FutureWarning)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:xlabel='LDAPS_Tmin_lapse', ylabel='Density'>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\seaborn\\distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).\n",
      "  warnings.warn(msg, FutureWarning)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:xlabel='LDAPS_WS', ylabel='Density'>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\seaborn\\distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).\n",
      "  warnings.warn(msg, FutureWarning)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:xlabel='LDAPS_LH', ylabel='Density'>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\seaborn\\distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).\n",
      "  warnings.warn(msg, FutureWarning)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:xlabel='LDAPS_CC1', ylabel='Density'>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\seaborn\\distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).\n",
      "  warnings.warn(msg, FutureWarning)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:xlabel='LDAPS_CC2', ylabel='Density'>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\seaborn\\distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).\n",
      "  warnings.warn(msg, FutureWarning)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:xlabel='LDAPS_CC3', ylabel='Density'>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\seaborn\\distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).\n",
      "  warnings.warn(msg, FutureWarning)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:xlabel='LDAPS_CC4', ylabel='Density'>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\seaborn\\distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).\n",
      "  warnings.warn(msg, FutureWarning)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:xlabel='LDAPS_PPT1', ylabel='Density'>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\seaborn\\distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).\n",
      "  warnings.warn(msg, FutureWarning)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:xlabel='LDAPS_PPT2', ylabel='Density'>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\seaborn\\distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).\n",
      "  warnings.warn(msg, FutureWarning)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:xlabel='LDAPS_PPT3', ylabel='Density'>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\seaborn\\distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).\n",
      "  warnings.warn(msg, FutureWarning)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:xlabel='LDAPS_PPT4', ylabel='Density'>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\seaborn\\distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).\n",
      "  warnings.warn(msg, FutureWarning)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:xlabel='lat', ylabel='Density'>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\seaborn\\distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).\n",
      "  warnings.warn(msg, FutureWarning)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:xlabel='lon', ylabel='Density'>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\seaborn\\distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).\n",
      "  warnings.warn(msg, FutureWarning)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:xlabel='DEM', ylabel='Density'>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\seaborn\\distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).\n",
      "  warnings.warn(msg, FutureWarning)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:xlabel='Slope', ylabel='Density'>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\seaborn\\distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).\n",
      "  warnings.warn(msg, FutureWarning)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:xlabel='Solar radiation', ylabel='Density'>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\seaborn\\distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).\n",
      "  warnings.warn(msg, FutureWarning)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:xlabel='Next_Tmax', ylabel='Density'>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\seaborn\\distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).\n",
      "  warnings.warn(msg, FutureWarning)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:xlabel='Next_Tmin', ylabel='Density'>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 绘制每列数据的直方图（分布频次）\n",
    "plot = Data.drop('Date',axis=1) # 删除'Date'列\n",
    "\n",
    "for I in plot.columns:\n",
    "    sns.distplot(plot[I]) \n",
    "    plt.show() "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f9d4c878",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "ccd62e2333aa4b08bbdadbf571dde473",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Summarize dataset:   0%|          | 0/5 [00:00<?, ?it/s]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 生成整体数据概要\n",
    "data_report=pp.ProfileReport(Data) \n",
    "data_report\n",
    "\n",
    "# 也可以把生成的报告导出保存\n",
    "data_report.to_file('report.html') "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "3e7e9778",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 由于本数据集的特殊性（有两个样本标签：次日最高气温和最低气温）\n",
    "#，本案例中我们只进行次日最高温预测--因此这里只选出与最高温预测相关的变量，作为建模要用的数据\n",
    "\n",
    "Max = Data[['Present_Tmax','LDAPS_RHmax','LDAPS_Tmax_lapse','LDAPS_WS','LDAPS_LH','LDAPS_CC1','LDAPS_CC2','LDAPS_CC3','LDAPS_CC4','LDAPS_PPT1','LDAPS_PPT4',\n",
    "          'lat','lon','DEM','Slope','Solar radiation','Next_Tmax']] "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "e1729c15",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Present_Tmax</th>\n",
       "      <th>LDAPS_RHmax</th>\n",
       "      <th>LDAPS_Tmax_lapse</th>\n",
       "      <th>LDAPS_WS</th>\n",
       "      <th>LDAPS_LH</th>\n",
       "      <th>LDAPS_CC1</th>\n",
       "      <th>LDAPS_CC2</th>\n",
       "      <th>LDAPS_CC3</th>\n",
       "      <th>LDAPS_CC4</th>\n",
       "      <th>LDAPS_PPT1</th>\n",
       "      <th>LDAPS_PPT4</th>\n",
       "      <th>lat</th>\n",
       "      <th>lon</th>\n",
       "      <th>DEM</th>\n",
       "      <th>Slope</th>\n",
       "      <th>Solar radiation</th>\n",
       "      <th>Next_Tmax</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>28.7</td>\n",
       "      <td>91.116364</td>\n",
       "      <td>28.074101</td>\n",
       "      <td>6.818887</td>\n",
       "      <td>69.451805</td>\n",
       "      <td>0.233947</td>\n",
       "      <td>0.203896</td>\n",
       "      <td>0.161697</td>\n",
       "      <td>0.130928</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>37.6046</td>\n",
       "      <td>126.991</td>\n",
       "      <td>212.3350</td>\n",
       "      <td>2.7850</td>\n",
       "      <td>5992.895996</td>\n",
       "      <td>29.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>31.9</td>\n",
       "      <td>90.604721</td>\n",
       "      <td>29.850689</td>\n",
       "      <td>5.691890</td>\n",
       "      <td>51.937448</td>\n",
       "      <td>0.225508</td>\n",
       "      <td>0.251771</td>\n",
       "      <td>0.159444</td>\n",
       "      <td>0.127727</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>37.6046</td>\n",
       "      <td>127.032</td>\n",
       "      <td>44.7624</td>\n",
       "      <td>0.5141</td>\n",
       "      <td>5869.312500</td>\n",
       "      <td>30.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>31.6</td>\n",
       "      <td>83.973587</td>\n",
       "      <td>30.091292</td>\n",
       "      <td>6.138224</td>\n",
       "      <td>20.573050</td>\n",
       "      <td>0.209344</td>\n",
       "      <td>0.257469</td>\n",
       "      <td>0.204091</td>\n",
       "      <td>0.142125</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>37.5776</td>\n",
       "      <td>127.058</td>\n",
       "      <td>33.3068</td>\n",
       "      <td>0.2661</td>\n",
       "      <td>5863.555664</td>\n",
       "      <td>31.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>32.0</td>\n",
       "      <td>96.483688</td>\n",
       "      <td>29.704629</td>\n",
       "      <td>5.650050</td>\n",
       "      <td>65.727144</td>\n",
       "      <td>0.216372</td>\n",
       "      <td>0.226002</td>\n",
       "      <td>0.161157</td>\n",
       "      <td>0.134249</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>37.6450</td>\n",
       "      <td>127.022</td>\n",
       "      <td>45.7160</td>\n",
       "      <td>2.5348</td>\n",
       "      <td>5856.964844</td>\n",
       "      <td>31.7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>31.4</td>\n",
       "      <td>90.155128</td>\n",
       "      <td>29.113934</td>\n",
       "      <td>5.735004</td>\n",
       "      <td>107.965535</td>\n",
       "      <td>0.151407</td>\n",
       "      <td>0.249995</td>\n",
       "      <td>0.178892</td>\n",
       "      <td>0.170021</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>37.5507</td>\n",
       "      <td>127.135</td>\n",
       "      <td>35.0380</td>\n",
       "      <td>0.5055</td>\n",
       "      <td>5859.552246</td>\n",
       "      <td>31.2</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Present_Tmax  LDAPS_RHmax  LDAPS_Tmax_lapse  LDAPS_WS    LDAPS_LH  \\\n",
       "0          28.7    91.116364         28.074101  6.818887   69.451805   \n",
       "1          31.9    90.604721         29.850689  5.691890   51.937448   \n",
       "2          31.6    83.973587         30.091292  6.138224   20.573050   \n",
       "3          32.0    96.483688         29.704629  5.650050   65.727144   \n",
       "4          31.4    90.155128         29.113934  5.735004  107.965535   \n",
       "\n",
       "   LDAPS_CC1  LDAPS_CC2  LDAPS_CC3  LDAPS_CC4  LDAPS_PPT1  LDAPS_PPT4  \\\n",
       "0   0.233947   0.203896   0.161697   0.130928         0.0         0.0   \n",
       "1   0.225508   0.251771   0.159444   0.127727         0.0         0.0   \n",
       "2   0.209344   0.257469   0.204091   0.142125         0.0         0.0   \n",
       "3   0.216372   0.226002   0.161157   0.134249         0.0         0.0   \n",
       "4   0.151407   0.249995   0.178892   0.170021         0.0         0.0   \n",
       "\n",
       "       lat      lon       DEM   Slope  Solar radiation  Next_Tmax  \n",
       "0  37.6046  126.991  212.3350  2.7850      5992.895996       29.1  \n",
       "1  37.6046  127.032   44.7624  0.5141      5869.312500       30.5  \n",
       "2  37.5776  127.058   33.3068  0.2661      5863.555664       31.1  \n",
       "3  37.6450  127.022   45.7160  2.5348      5856.964844       31.7  \n",
       "4  37.5507  127.135   35.0380  0.5055      5859.552246       31.2  "
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Max.head() "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "f1faea8a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 7752 entries, 0 to 7751\n",
      "Data columns (total 17 columns):\n",
      " #   Column            Non-Null Count  Dtype  \n",
      "---  ------            --------------  -----  \n",
      " 0   Present_Tmax      7682 non-null   float64\n",
      " 1   LDAPS_RHmax       7677 non-null   float64\n",
      " 2   LDAPS_Tmax_lapse  7677 non-null   float64\n",
      " 3   LDAPS_WS          7677 non-null   float64\n",
      " 4   LDAPS_LH          7677 non-null   float64\n",
      " 5   LDAPS_CC1         7677 non-null   float64\n",
      " 6   LDAPS_CC2         7677 non-null   float64\n",
      " 7   LDAPS_CC3         7677 non-null   float64\n",
      " 8   LDAPS_CC4         7677 non-null   float64\n",
      " 9   LDAPS_PPT1        7677 non-null   float64\n",
      " 10  LDAPS_PPT4        7677 non-null   float64\n",
      " 11  lat               7752 non-null   float64\n",
      " 12  lon               7752 non-null   float64\n",
      " 13  DEM               7752 non-null   float64\n",
      " 14  Slope             7752 non-null   float64\n",
      " 15  Solar radiation   7752 non-null   float64\n",
      " 16  Next_Tmax         7725 non-null   float64\n",
      "dtypes: float64(17)\n",
      "memory usage: 1.0 MB\n"
     ]
    }
   ],
   "source": [
    "Max.info() "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "173e9f95",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>count</th>\n",
       "      <th>mean</th>\n",
       "      <th>std</th>\n",
       "      <th>min</th>\n",
       "      <th>25%</th>\n",
       "      <th>50%</th>\n",
       "      <th>75%</th>\n",
       "      <th>max</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>Present_Tmax</th>\n",
       "      <td>7752.0</td>\n",
       "      <td>29.768211</td>\n",
       "      <td>2.956557</td>\n",
       "      <td>20.000000</td>\n",
       "      <td>27.800000</td>\n",
       "      <td>29.900000</td>\n",
       "      <td>32.000000</td>\n",
       "      <td>37.600000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>LDAPS_RHmax</th>\n",
       "      <td>7752.0</td>\n",
       "      <td>88.374804</td>\n",
       "      <td>7.157124</td>\n",
       "      <td>58.936283</td>\n",
       "      <td>84.316923</td>\n",
       "      <td>89.699505</td>\n",
       "      <td>93.704500</td>\n",
       "      <td>100.000153</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>LDAPS_Tmax_lapse</th>\n",
       "      <td>7752.0</td>\n",
       "      <td>29.613447</td>\n",
       "      <td>2.932898</td>\n",
       "      <td>17.624954</td>\n",
       "      <td>27.693091</td>\n",
       "      <td>29.662273</td>\n",
       "      <td>31.683819</td>\n",
       "      <td>38.542255</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>LDAPS_WS</th>\n",
       "      <td>7752.0</td>\n",
       "      <td>7.097875</td>\n",
       "      <td>2.173245</td>\n",
       "      <td>2.882580</td>\n",
       "      <td>5.686487</td>\n",
       "      <td>6.563068</td>\n",
       "      <td>8.007471</td>\n",
       "      <td>21.857621</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>LDAPS_LH</th>\n",
       "      <td>7752.0</td>\n",
       "      <td>62.505019</td>\n",
       "      <td>33.567001</td>\n",
       "      <td>-13.603212</td>\n",
       "      <td>37.532764</td>\n",
       "      <td>57.310630</td>\n",
       "      <td>83.904586</td>\n",
       "      <td>213.414006</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>LDAPS_CC1</th>\n",
       "      <td>7752.0</td>\n",
       "      <td>0.368774</td>\n",
       "      <td>0.261185</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.148321</td>\n",
       "      <td>0.320110</td>\n",
       "      <td>0.571696</td>\n",
       "      <td>0.967277</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>LDAPS_CC2</th>\n",
       "      <td>7752.0</td>\n",
       "      <td>0.356080</td>\n",
       "      <td>0.256810</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.142328</td>\n",
       "      <td>0.315667</td>\n",
       "      <td>0.554963</td>\n",
       "      <td>0.968353</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>LDAPS_CC3</th>\n",
       "      <td>7752.0</td>\n",
       "      <td>0.318404</td>\n",
       "      <td>0.249148</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.103100</td>\n",
       "      <td>0.265264</td>\n",
       "      <td>0.494007</td>\n",
       "      <td>0.983789</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>LDAPS_CC4</th>\n",
       "      <td>7752.0</td>\n",
       "      <td>0.299191</td>\n",
       "      <td>0.253114</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.082741</td>\n",
       "      <td>0.232354</td>\n",
       "      <td>0.497230</td>\n",
       "      <td>0.974710</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>LDAPS_PPT1</th>\n",
       "      <td>7752.0</td>\n",
       "      <td>0.591995</td>\n",
       "      <td>1.936331</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.067593</td>\n",
       "      <td>23.701544</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>LDAPS_PPT4</th>\n",
       "      <td>7752.0</td>\n",
       "      <td>0.269407</td>\n",
       "      <td>1.200364</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000693</td>\n",
       "      <td>16.655469</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>lat</th>\n",
       "      <td>7752.0</td>\n",
       "      <td>37.544722</td>\n",
       "      <td>0.050352</td>\n",
       "      <td>37.456200</td>\n",
       "      <td>37.510200</td>\n",
       "      <td>37.550700</td>\n",
       "      <td>37.577600</td>\n",
       "      <td>37.645000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>lon</th>\n",
       "      <td>7752.0</td>\n",
       "      <td>126.991397</td>\n",
       "      <td>0.079435</td>\n",
       "      <td>126.826000</td>\n",
       "      <td>126.937000</td>\n",
       "      <td>126.995000</td>\n",
       "      <td>127.042000</td>\n",
       "      <td>127.135000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>DEM</th>\n",
       "      <td>7752.0</td>\n",
       "      <td>61.867972</td>\n",
       "      <td>54.279780</td>\n",
       "      <td>12.370000</td>\n",
       "      <td>28.700000</td>\n",
       "      <td>45.716000</td>\n",
       "      <td>59.832400</td>\n",
       "      <td>212.335000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Slope</th>\n",
       "      <td>7752.0</td>\n",
       "      <td>1.257048</td>\n",
       "      <td>1.370444</td>\n",
       "      <td>0.098475</td>\n",
       "      <td>0.271300</td>\n",
       "      <td>0.618000</td>\n",
       "      <td>1.767800</td>\n",
       "      <td>5.178230</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Solar radiation</th>\n",
       "      <td>7752.0</td>\n",
       "      <td>5341.502803</td>\n",
       "      <td>429.158867</td>\n",
       "      <td>4329.520508</td>\n",
       "      <td>4999.018555</td>\n",
       "      <td>5436.345215</td>\n",
       "      <td>5728.316406</td>\n",
       "      <td>5992.895996</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Next_Tmax</th>\n",
       "      <td>7752.0</td>\n",
       "      <td>30.274887</td>\n",
       "      <td>3.122557</td>\n",
       "      <td>17.400000</td>\n",
       "      <td>28.200000</td>\n",
       "      <td>30.500000</td>\n",
       "      <td>32.600000</td>\n",
       "      <td>38.900000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                   count         mean         std          min          25%  \\\n",
       "Present_Tmax      7752.0    29.768211    2.956557    20.000000    27.800000   \n",
       "LDAPS_RHmax       7752.0    88.374804    7.157124    58.936283    84.316923   \n",
       "LDAPS_Tmax_lapse  7752.0    29.613447    2.932898    17.624954    27.693091   \n",
       "LDAPS_WS          7752.0     7.097875    2.173245     2.882580     5.686487   \n",
       "LDAPS_LH          7752.0    62.505019   33.567001   -13.603212    37.532764   \n",
       "LDAPS_CC1         7752.0     0.368774    0.261185     0.000000     0.148321   \n",
       "LDAPS_CC2         7752.0     0.356080    0.256810     0.000000     0.142328   \n",
       "LDAPS_CC3         7752.0     0.318404    0.249148     0.000000     0.103100   \n",
       "LDAPS_CC4         7752.0     0.299191    0.253114     0.000000     0.082741   \n",
       "LDAPS_PPT1        7752.0     0.591995    1.936331     0.000000     0.000000   \n",
       "LDAPS_PPT4        7752.0     0.269407    1.200364     0.000000     0.000000   \n",
       "lat               7752.0    37.544722    0.050352    37.456200    37.510200   \n",
       "lon               7752.0   126.991397    0.079435   126.826000   126.937000   \n",
       "DEM               7752.0    61.867972   54.279780    12.370000    28.700000   \n",
       "Slope             7752.0     1.257048    1.370444     0.098475     0.271300   \n",
       "Solar radiation   7752.0  5341.502803  429.158867  4329.520508  4999.018555   \n",
       "Next_Tmax         7752.0    30.274887    3.122557    17.400000    28.200000   \n",
       "\n",
       "                          50%          75%          max  \n",
       "Present_Tmax        29.900000    32.000000    37.600000  \n",
       "LDAPS_RHmax         89.699505    93.704500   100.000153  \n",
       "LDAPS_Tmax_lapse    29.662273    31.683819    38.542255  \n",
       "LDAPS_WS             6.563068     8.007471    21.857621  \n",
       "LDAPS_LH            57.310630    83.904586   213.414006  \n",
       "LDAPS_CC1            0.320110     0.571696     0.967277  \n",
       "LDAPS_CC2            0.315667     0.554963     0.968353  \n",
       "LDAPS_CC3            0.265264     0.494007     0.983789  \n",
       "LDAPS_CC4            0.232354     0.497230     0.974710  \n",
       "LDAPS_PPT1           0.000000     0.067593    23.701544  \n",
       "LDAPS_PPT4           0.000000     0.000693    16.655469  \n",
       "lat                 37.550700    37.577600    37.645000  \n",
       "lon                126.995000   127.042000   127.135000  \n",
       "DEM                 45.716000    59.832400   212.335000  \n",
       "Slope                0.618000     1.767800     5.178230  \n",
       "Solar radiation   5436.345215  5728.316406  5992.895996  \n",
       "Next_Tmax           30.500000    32.600000    38.900000  "
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Max.describe().T"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "e562da95",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Present_Tmax        0\n",
       "LDAPS_RHmax         0\n",
       "LDAPS_Tmax_lapse    0\n",
       "LDAPS_WS            0\n",
       "LDAPS_LH            0\n",
       "LDAPS_CC1           0\n",
       "LDAPS_CC2           0\n",
       "LDAPS_CC3           0\n",
       "LDAPS_CC4           0\n",
       "LDAPS_PPT1          0\n",
       "LDAPS_PPT4          0\n",
       "lat                 0\n",
       "lon                 0\n",
       "DEM                 0\n",
       "Slope               0\n",
       "Solar radiation     0\n",
       "Next_Tmax           0\n",
       "dtype: int64"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 用每列的均值填充其缺失值\n",
    "for i in Max.columns:\n",
    "    Max[i].fillna(value=Max[i].mean(),inplace=True)   \n",
    "Max.isna().sum()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "06183c1c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Present_Tmax</th>\n",
       "      <th>LDAPS_RHmax</th>\n",
       "      <th>LDAPS_Tmax_lapse</th>\n",
       "      <th>LDAPS_WS</th>\n",
       "      <th>LDAPS_LH</th>\n",
       "      <th>LDAPS_CC1</th>\n",
       "      <th>LDAPS_CC2</th>\n",
       "      <th>LDAPS_CC3</th>\n",
       "      <th>LDAPS_CC4</th>\n",
       "      <th>LDAPS_PPT1</th>\n",
       "      <th>LDAPS_PPT4</th>\n",
       "      <th>lat</th>\n",
       "      <th>lon</th>\n",
       "      <th>DEM</th>\n",
       "      <th>Slope</th>\n",
       "      <th>Solar radiation</th>\n",
       "      <th>Next_Tmax</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>-0.361326</td>\n",
       "      <td>0.383078</td>\n",
       "      <td>-0.524889</td>\n",
       "      <td>-0.128382</td>\n",
       "      <td>0.206966</td>\n",
       "      <td>-0.516243</td>\n",
       "      <td>-0.592636</td>\n",
       "      <td>-0.629013</td>\n",
       "      <td>-0.664815</td>\n",
       "      <td>-0.305750</td>\n",
       "      <td>-0.224453</td>\n",
       "      <td>1.189286</td>\n",
       "      <td>-0.005000</td>\n",
       "      <td>2.772243</td>\n",
       "      <td>1.115004</td>\n",
       "      <td>1.517935</td>\n",
       "      <td>-0.376282</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0.721084</td>\n",
       "      <td>0.311586</td>\n",
       "      <td>0.080895</td>\n",
       "      <td>-0.646994</td>\n",
       "      <td>-0.314841</td>\n",
       "      <td>-0.548557</td>\n",
       "      <td>-0.406199</td>\n",
       "      <td>-0.638055</td>\n",
       "      <td>-0.677462</td>\n",
       "      <td>-0.305750</td>\n",
       "      <td>-0.224453</td>\n",
       "      <td>1.189286</td>\n",
       "      <td>0.511177</td>\n",
       "      <td>-0.315157</td>\n",
       "      <td>-0.542158</td>\n",
       "      <td>1.229950</td>\n",
       "      <td>0.072097</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.619608</td>\n",
       "      <td>-0.614982</td>\n",
       "      <td>0.162936</td>\n",
       "      <td>-0.441604</td>\n",
       "      <td>-1.249283</td>\n",
       "      <td>-0.610450</td>\n",
       "      <td>-0.384009</td>\n",
       "      <td>-0.458843</td>\n",
       "      <td>-0.620575</td>\n",
       "      <td>-0.305750</td>\n",
       "      <td>-0.224453</td>\n",
       "      <td>0.653021</td>\n",
       "      <td>0.838510</td>\n",
       "      <td>-0.526218</td>\n",
       "      <td>-0.723133</td>\n",
       "      <td>1.216534</td>\n",
       "      <td>0.264260</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0.754909</td>\n",
       "      <td>1.133054</td>\n",
       "      <td>0.031092</td>\n",
       "      <td>-0.666247</td>\n",
       "      <td>0.095997</td>\n",
       "      <td>-0.583539</td>\n",
       "      <td>-0.506548</td>\n",
       "      <td>-0.631178</td>\n",
       "      <td>-0.651696</td>\n",
       "      <td>-0.305750</td>\n",
       "      <td>-0.224453</td>\n",
       "      <td>1.991696</td>\n",
       "      <td>0.385280</td>\n",
       "      <td>-0.297588</td>\n",
       "      <td>0.932424</td>\n",
       "      <td>1.201176</td>\n",
       "      <td>0.456422</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0.551957</td>\n",
       "      <td>0.248765</td>\n",
       "      <td>-0.170325</td>\n",
       "      <td>-0.627154</td>\n",
       "      <td>1.354409</td>\n",
       "      <td>-0.832287</td>\n",
       "      <td>-0.413115</td>\n",
       "      <td>-0.559990</td>\n",
       "      <td>-0.510358</td>\n",
       "      <td>-0.305750</td>\n",
       "      <td>-0.224453</td>\n",
       "      <td>0.118743</td>\n",
       "      <td>1.807917</td>\n",
       "      <td>-0.494322</td>\n",
       "      <td>-0.548433</td>\n",
       "      <td>1.207205</td>\n",
       "      <td>0.296287</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7747</th>\n",
       "      <td>-2.187892</td>\n",
       "      <td>-1.328126</td>\n",
       "      <td>-1.112066</td>\n",
       "      <td>-0.436683</td>\n",
       "      <td>0.284622</td>\n",
       "      <td>-1.297018</td>\n",
       "      <td>-1.071078</td>\n",
       "      <td>-1.278054</td>\n",
       "      <td>-1.182118</td>\n",
       "      <td>-0.305750</td>\n",
       "      <td>-0.224453</td>\n",
       "      <td>-0.149390</td>\n",
       "      <td>-1.263971</td>\n",
       "      <td>-0.852681</td>\n",
       "      <td>-0.803915</td>\n",
       "      <td>-2.093040</td>\n",
       "      <td>-0.632499</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7748</th>\n",
       "      <td>-2.187892</td>\n",
       "      <td>-1.548184</td>\n",
       "      <td>-0.887662</td>\n",
       "      <td>-0.255421</td>\n",
       "      <td>-0.454749</td>\n",
       "      <td>-1.274658</td>\n",
       "      <td>-1.094726</td>\n",
       "      <td>-1.278054</td>\n",
       "      <td>-1.182118</td>\n",
       "      <td>-0.305750</td>\n",
       "      <td>-0.224453</td>\n",
       "      <td>-0.417522</td>\n",
       "      <td>-1.037356</td>\n",
       "      <td>-0.821213</td>\n",
       "      <td>-0.755095</td>\n",
       "      <td>-2.104553</td>\n",
       "      <td>-0.536418</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7749</th>\n",
       "      <td>-2.221718</td>\n",
       "      <td>-1.555342</td>\n",
       "      <td>-0.570780</td>\n",
       "      <td>0.088072</td>\n",
       "      <td>-1.591397</td>\n",
       "      <td>-1.224577</td>\n",
       "      <td>-1.153504</td>\n",
       "      <td>-1.278054</td>\n",
       "      <td>-1.178973</td>\n",
       "      <td>-0.305750</td>\n",
       "      <td>-0.224453</td>\n",
       "      <td>-0.417522</td>\n",
       "      <td>-0.269384</td>\n",
       "      <td>-0.779043</td>\n",
       "      <td>-0.719338</td>\n",
       "      <td>-2.074325</td>\n",
       "      <td>-0.792634</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7750</th>\n",
       "      <td>-3.304127</td>\n",
       "      <td>-4.113443</td>\n",
       "      <td>-4.087857</td>\n",
       "      <td>-1.939757</td>\n",
       "      <td>-2.267499</td>\n",
       "      <td>-1.412018</td>\n",
       "      <td>-1.386643</td>\n",
       "      <td>-1.278054</td>\n",
       "      <td>-1.182118</td>\n",
       "      <td>-0.305750</td>\n",
       "      <td>-0.224453</td>\n",
       "      <td>-1.758184</td>\n",
       "      <td>-2.082302</td>\n",
       "      <td>-0.911963</td>\n",
       "      <td>-0.845455</td>\n",
       "      <td>-2.358212</td>\n",
       "      <td>-4.123453</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7751</th>\n",
       "      <td>2.649126</td>\n",
       "      <td>1.624409</td>\n",
       "      <td>3.044561</td>\n",
       "      <td>6.792009</td>\n",
       "      <td>4.496044</td>\n",
       "      <td>2.291644</td>\n",
       "      <td>2.384303</td>\n",
       "      <td>2.670813</td>\n",
       "      <td>2.669002</td>\n",
       "      <td>11.935477</td>\n",
       "      <td>13.651790</td>\n",
       "      <td>1.991696</td>\n",
       "      <td>1.807917</td>\n",
       "      <td>2.772243</td>\n",
       "      <td>2.861435</td>\n",
       "      <td>1.517935</td>\n",
       "      <td>2.762374</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>7752 rows × 17 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      Present_Tmax  LDAPS_RHmax  LDAPS_Tmax_lapse  LDAPS_WS  LDAPS_LH  \\\n",
       "0        -0.361326     0.383078         -0.524889 -0.128382  0.206966   \n",
       "1         0.721084     0.311586          0.080895 -0.646994 -0.314841   \n",
       "2         0.619608    -0.614982          0.162936 -0.441604 -1.249283   \n",
       "3         0.754909     1.133054          0.031092 -0.666247  0.095997   \n",
       "4         0.551957     0.248765         -0.170325 -0.627154  1.354409   \n",
       "...            ...          ...               ...       ...       ...   \n",
       "7747     -2.187892    -1.328126         -1.112066 -0.436683  0.284622   \n",
       "7748     -2.187892    -1.548184         -0.887662 -0.255421 -0.454749   \n",
       "7749     -2.221718    -1.555342         -0.570780  0.088072 -1.591397   \n",
       "7750     -3.304127    -4.113443         -4.087857 -1.939757 -2.267499   \n",
       "7751      2.649126     1.624409          3.044561  6.792009  4.496044   \n",
       "\n",
       "      LDAPS_CC1  LDAPS_CC2  LDAPS_CC3  LDAPS_CC4  LDAPS_PPT1  LDAPS_PPT4  \\\n",
       "0     -0.516243  -0.592636  -0.629013  -0.664815   -0.305750   -0.224453   \n",
       "1     -0.548557  -0.406199  -0.638055  -0.677462   -0.305750   -0.224453   \n",
       "2     -0.610450  -0.384009  -0.458843  -0.620575   -0.305750   -0.224453   \n",
       "3     -0.583539  -0.506548  -0.631178  -0.651696   -0.305750   -0.224453   \n",
       "4     -0.832287  -0.413115  -0.559990  -0.510358   -0.305750   -0.224453   \n",
       "...         ...        ...        ...        ...         ...         ...   \n",
       "7747  -1.297018  -1.071078  -1.278054  -1.182118   -0.305750   -0.224453   \n",
       "7748  -1.274658  -1.094726  -1.278054  -1.182118   -0.305750   -0.224453   \n",
       "7749  -1.224577  -1.153504  -1.278054  -1.178973   -0.305750   -0.224453   \n",
       "7750  -1.412018  -1.386643  -1.278054  -1.182118   -0.305750   -0.224453   \n",
       "7751   2.291644   2.384303   2.670813   2.669002   11.935477   13.651790   \n",
       "\n",
       "           lat       lon       DEM     Slope  Solar radiation  Next_Tmax  \n",
       "0     1.189286 -0.005000  2.772243  1.115004         1.517935  -0.376282  \n",
       "1     1.189286  0.511177 -0.315157 -0.542158         1.229950   0.072097  \n",
       "2     0.653021  0.838510 -0.526218 -0.723133         1.216534   0.264260  \n",
       "3     1.991696  0.385280 -0.297588  0.932424         1.201176   0.456422  \n",
       "4     0.118743  1.807917 -0.494322 -0.548433         1.207205   0.296287  \n",
       "...        ...       ...       ...       ...              ...        ...  \n",
       "7747 -0.149390 -1.263971 -0.852681 -0.803915        -2.093040  -0.632499  \n",
       "7748 -0.417522 -1.037356 -0.821213 -0.755095        -2.104553  -0.536418  \n",
       "7749 -0.417522 -0.269384 -0.779043 -0.719338        -2.074325  -0.792634  \n",
       "7750 -1.758184 -2.082302 -0.911963 -0.845455        -2.358212  -4.123453  \n",
       "7751  1.991696  1.807917  2.772243  2.861435         1.517935   2.762374  \n",
       "\n",
       "[7752 rows x 17 columns]"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from sklearn.preprocessing import StandardScaler \n",
    "\n",
    "#标准化处理连续型特征 （10分）\n",
    "ss = StandardScaler()\n",
    "ss_data = ss.fit_transform(Max) \n",
    "ss_data=pd.DataFrame(ss_data,columns=Max.columns) \n",
    "ss_data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "87371ecb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Present_Tmax</th>\n",
       "      <th>LDAPS_RHmax</th>\n",
       "      <th>LDAPS_Tmax_lapse</th>\n",
       "      <th>LDAPS_WS</th>\n",
       "      <th>LDAPS_LH</th>\n",
       "      <th>LDAPS_CC1</th>\n",
       "      <th>LDAPS_CC2</th>\n",
       "      <th>LDAPS_CC3</th>\n",
       "      <th>LDAPS_CC4</th>\n",
       "      <th>LDAPS_PPT1</th>\n",
       "      <th>LDAPS_PPT4</th>\n",
       "      <th>lat</th>\n",
       "      <th>lon</th>\n",
       "      <th>DEM</th>\n",
       "      <th>Slope</th>\n",
       "      <th>Solar radiation</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>-0.361326</td>\n",
       "      <td>0.383078</td>\n",
       "      <td>-0.524889</td>\n",
       "      <td>-0.128382</td>\n",
       "      <td>0.206966</td>\n",
       "      <td>-0.516243</td>\n",
       "      <td>-0.592636</td>\n",
       "      <td>-0.629013</td>\n",
       "      <td>-0.664815</td>\n",
       "      <td>-0.30575</td>\n",
       "      <td>-0.224453</td>\n",
       "      <td>1.189286</td>\n",
       "      <td>-0.005000</td>\n",
       "      <td>2.772243</td>\n",
       "      <td>1.115004</td>\n",
       "      <td>1.517935</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0.721084</td>\n",
       "      <td>0.311586</td>\n",
       "      <td>0.080895</td>\n",
       "      <td>-0.646994</td>\n",
       "      <td>-0.314841</td>\n",
       "      <td>-0.548557</td>\n",
       "      <td>-0.406199</td>\n",
       "      <td>-0.638055</td>\n",
       "      <td>-0.677462</td>\n",
       "      <td>-0.30575</td>\n",
       "      <td>-0.224453</td>\n",
       "      <td>1.189286</td>\n",
       "      <td>0.511177</td>\n",
       "      <td>-0.315157</td>\n",
       "      <td>-0.542158</td>\n",
       "      <td>1.229950</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.619608</td>\n",
       "      <td>-0.614982</td>\n",
       "      <td>0.162936</td>\n",
       "      <td>-0.441604</td>\n",
       "      <td>-1.249283</td>\n",
       "      <td>-0.610450</td>\n",
       "      <td>-0.384009</td>\n",
       "      <td>-0.458843</td>\n",
       "      <td>-0.620575</td>\n",
       "      <td>-0.30575</td>\n",
       "      <td>-0.224453</td>\n",
       "      <td>0.653021</td>\n",
       "      <td>0.838510</td>\n",
       "      <td>-0.526218</td>\n",
       "      <td>-0.723133</td>\n",
       "      <td>1.216534</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0.754909</td>\n",
       "      <td>1.133054</td>\n",
       "      <td>0.031092</td>\n",
       "      <td>-0.666247</td>\n",
       "      <td>0.095997</td>\n",
       "      <td>-0.583539</td>\n",
       "      <td>-0.506548</td>\n",
       "      <td>-0.631178</td>\n",
       "      <td>-0.651696</td>\n",
       "      <td>-0.30575</td>\n",
       "      <td>-0.224453</td>\n",
       "      <td>1.991696</td>\n",
       "      <td>0.385280</td>\n",
       "      <td>-0.297588</td>\n",
       "      <td>0.932424</td>\n",
       "      <td>1.201176</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0.551957</td>\n",
       "      <td>0.248765</td>\n",
       "      <td>-0.170325</td>\n",
       "      <td>-0.627154</td>\n",
       "      <td>1.354409</td>\n",
       "      <td>-0.832287</td>\n",
       "      <td>-0.413115</td>\n",
       "      <td>-0.559990</td>\n",
       "      <td>-0.510358</td>\n",
       "      <td>-0.30575</td>\n",
       "      <td>-0.224453</td>\n",
       "      <td>0.118743</td>\n",
       "      <td>1.807917</td>\n",
       "      <td>-0.494322</td>\n",
       "      <td>-0.548433</td>\n",
       "      <td>1.207205</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Present_Tmax  LDAPS_RHmax  LDAPS_Tmax_lapse  LDAPS_WS  LDAPS_LH  LDAPS_CC1  \\\n",
       "0     -0.361326     0.383078         -0.524889 -0.128382  0.206966  -0.516243   \n",
       "1      0.721084     0.311586          0.080895 -0.646994 -0.314841  -0.548557   \n",
       "2      0.619608    -0.614982          0.162936 -0.441604 -1.249283  -0.610450   \n",
       "3      0.754909     1.133054          0.031092 -0.666247  0.095997  -0.583539   \n",
       "4      0.551957     0.248765         -0.170325 -0.627154  1.354409  -0.832287   \n",
       "\n",
       "   LDAPS_CC2  LDAPS_CC3  LDAPS_CC4  LDAPS_PPT1  LDAPS_PPT4       lat  \\\n",
       "0  -0.592636  -0.629013  -0.664815    -0.30575   -0.224453  1.189286   \n",
       "1  -0.406199  -0.638055  -0.677462    -0.30575   -0.224453  1.189286   \n",
       "2  -0.384009  -0.458843  -0.620575    -0.30575   -0.224453  0.653021   \n",
       "3  -0.506548  -0.631178  -0.651696    -0.30575   -0.224453  1.991696   \n",
       "4  -0.413115  -0.559990  -0.510358    -0.30575   -0.224453  0.118743   \n",
       "\n",
       "        lon       DEM     Slope  Solar radiation  \n",
       "0 -0.005000  2.772243  1.115004         1.517935  \n",
       "1  0.511177 -0.315157 -0.542158         1.229950  \n",
       "2  0.838510 -0.526218 -0.723133         1.216534  \n",
       "3  0.385280 -0.297588  0.932424         1.201176  \n",
       "4  1.807917 -0.494322 -0.548433         1.207205  "
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X = ss_data.drop(['Next_Tmax'],axis=1) \n",
    "X.head() "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "6eab30be",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0      -0.376282\n",
       "1       0.072097\n",
       "2       0.264260\n",
       "3       0.456422\n",
       "4       0.296287\n",
       "          ...   \n",
       "7747   -0.632499\n",
       "7748   -0.536418\n",
       "7749   -0.792634\n",
       "7750   -4.123453\n",
       "7751    2.762374\n",
       "Name: Next_Tmax, Length: 7752, dtype: float64"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Y = ss_data['Next_Tmax']\n",
    "Y"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "id": "7f661f08",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "LinearRegression()"
      ]
     },
     "execution_count": 61,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "(array([ 0.21194007,  0.04487062,  0.61455479, -0.09141687,  0.06361017,\n",
       "        -0.08578145,  0.0440428 , -0.05576834, -0.07899357,  0.01785141,\n",
       "        -0.00493507, -0.02528793, -0.05786128, -0.09904086,  0.10048124,\n",
       "         0.02270845]),\n",
       " 0.0016616234880887587)"
      ]
     },
     "execution_count": 61,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.7570395775105323 0.742869496890571\n"
     ]
    }
   ],
   "source": [
    "from sklearn.model_selection import train_test_split\n",
    "from sklearn.linear_model import LinearRegression\n",
    "X_train,X_test,Y_train,Y_test = train_test_split(X,Y,test_size=0.2,random_state=420)\n",
    "lr = LinearRegression(fit_intercept=True)\n",
    "lr.fit(X_train,Y_train) \n",
    "lr.coef_  ,lr.intercept_\n",
    "print(lr.score(X_train,Y_train), lr.score(X_test,Y_test))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "id": "ce39ee6a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(0.25266554606897107, 0.5026584785607133)"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from sklearn.metrics import mean_squared_error,r2_score\n",
    "yhat = lr.predict(X_test)\n",
    "mse = mean_squared_error(Y_test,yhat)\n",
    "r2 = r2_score(Y_test,yhat)\n",
    "rmse = np.sqrt(mse)\n",
    "mse,rmse"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "id": "1575918c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Figure size 2000x1000 with 0 Axes>"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x2ce11d2eef0>]"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x2ce1222bac0>]"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "<matplotlib.legend.Legend at 0x2ce11c463e0>"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 画个折线图来看看模型拟合的好坏程度\n",
    "plt.figure(figsize=(20,10)) \n",
    "plt.plot(range(len(Y_test)), Y_test, 'r', label='Y-TEST')\n",
    "plt.plot(range(len(Y_test)), yhat, 'b', label='Y-PREDICTED')\n",
    "plt.legend() \n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "id": "df0fd080",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.collections.PathCollection at 0x2ce1b2513f0>"
      ]
     },
     "execution_count": 63,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "Text(0.5, 0, 'Y-TEST')"
      ]
     },
     "execution_count": 63,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "Text(0, 0.5, 'Y-PREDICTED')"
      ]
     },
     "execution_count": 63,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "plt.scatter(Y_test, yhat, color='blue', label='Y-TEST')\n",
    "plt.xlabel('Y-TEST')\n",
    "plt.ylabel('Y-PREDICTED')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "id": "97a0b5ba",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.collections.PathCollection at 0x2ce1afd0d90>"
      ]
     },
     "execution_count": 67,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "<matplotlib.lines.Line2D at 0x2ce19b5faf0>"
      ]
     },
     "execution_count": 67,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "Text(0.5, 0, 'Y_observed')"
      ]
     },
     "execution_count": 67,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "Text(0, 0.5, 'Y_predicted')"
      ]
     },
     "execution_count": 67,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 绘制残差图查看模型的拟合情况（10分）\n",
    "from sklearn.model_selection import cross_val_predict,cross_val_score\n",
    "Y_pred=cross_val_predict(lr,X,Y,cv=5)\n",
    "\n",
    "fig,ax=plt.subplots(figsize=(20,10)) \n",
    "ax.scatter(Y,Y-Y_pred) \n",
    "ax.axhline(lw=5,color='blue')\n",
    "ax.set_xlabel('Y_observed')\n",
    "ax.set_ylabel('Y_predicted')\n",
    "plt.show() "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "id": "bd354c6a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:>"
      ]
     },
     "execution_count": 70,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "<module 'seaborn' from 'C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Programs\\\\Python\\\\Python310\\\\lib\\\\site-packages\\\\seaborn\\\\__init__.py'>"
      ]
     },
     "execution_count": 70,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "corrMax=X.corr() \n",
    "\n",
    "fig,ax=plt.subplots(figsize=(15,10))\n",
    "mask=np.array(corrMax)\n",
    "mask[np.tril_indices_from(mask)]=False\n",
    "sns.heatmap(corrMax,mask=mask, vmax=1,square=True,annot=True) \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 96,
   "id": "062b5076",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Present_Tmax</th>\n",
       "      <th>LDAPS_RHmax</th>\n",
       "      <th>LDAPS_Tmax_lapse</th>\n",
       "      <th>LDAPS_WS</th>\n",
       "      <th>LDAPS_LH</th>\n",
       "      <th>LDAPS_CC1</th>\n",
       "      <th>LDAPS_CC2</th>\n",
       "      <th>LDAPS_CC3</th>\n",
       "      <th>LDAPS_CC4</th>\n",
       "      <th>LDAPS_PPT1</th>\n",
       "      <th>LDAPS_PPT4</th>\n",
       "      <th>lat</th>\n",
       "      <th>lon</th>\n",
       "      <th>DEM</th>\n",
       "      <th>Slope</th>\n",
       "      <th>Solar radiation</th>\n",
       "      <th>Next_Tmax</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>-0.361326</td>\n",
       "      <td>0.383078</td>\n",
       "      <td>-0.524889</td>\n",
       "      <td>-0.128382</td>\n",
       "      <td>0.206966</td>\n",
       "      <td>-0.516243</td>\n",
       "      <td>-0.592636</td>\n",
       "      <td>-0.629013</td>\n",
       "      <td>-0.664815</td>\n",
       "      <td>-0.305750</td>\n",
       "      <td>-0.224453</td>\n",
       "      <td>1.189286</td>\n",
       "      <td>-0.005000</td>\n",
       "      <td>2.772243</td>\n",
       "      <td>1.115004</td>\n",
       "      <td>1.517935</td>\n",
       "      <td>-0.376282</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0.721084</td>\n",
       "      <td>0.311586</td>\n",
       "      <td>0.080895</td>\n",
       "      <td>-0.646994</td>\n",
       "      <td>-0.314841</td>\n",
       "      <td>-0.548557</td>\n",
       "      <td>-0.406199</td>\n",
       "      <td>-0.638055</td>\n",
       "      <td>-0.677462</td>\n",
       "      <td>-0.305750</td>\n",
       "      <td>-0.224453</td>\n",
       "      <td>1.189286</td>\n",
       "      <td>0.511177</td>\n",
       "      <td>-0.315157</td>\n",
       "      <td>-0.542158</td>\n",
       "      <td>1.229950</td>\n",
       "      <td>0.072097</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.619608</td>\n",
       "      <td>-0.614982</td>\n",
       "      <td>0.162936</td>\n",
       "      <td>-0.441604</td>\n",
       "      <td>-1.249283</td>\n",
       "      <td>-0.610450</td>\n",
       "      <td>-0.384009</td>\n",
       "      <td>-0.458843</td>\n",
       "      <td>-0.620575</td>\n",
       "      <td>-0.305750</td>\n",
       "      <td>-0.224453</td>\n",
       "      <td>0.653021</td>\n",
       "      <td>0.838510</td>\n",
       "      <td>-0.526218</td>\n",
       "      <td>-0.723133</td>\n",
       "      <td>1.216534</td>\n",
       "      <td>0.264260</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0.754909</td>\n",
       "      <td>1.133054</td>\n",
       "      <td>0.031092</td>\n",
       "      <td>-0.666247</td>\n",
       "      <td>0.095997</td>\n",
       "      <td>-0.583539</td>\n",
       "      <td>-0.506548</td>\n",
       "      <td>-0.631178</td>\n",
       "      <td>-0.651696</td>\n",
       "      <td>-0.305750</td>\n",
       "      <td>-0.224453</td>\n",
       "      <td>1.991696</td>\n",
       "      <td>0.385280</td>\n",
       "      <td>-0.297588</td>\n",
       "      <td>0.932424</td>\n",
       "      <td>1.201176</td>\n",
       "      <td>0.456422</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0.551957</td>\n",
       "      <td>0.248765</td>\n",
       "      <td>-0.170325</td>\n",
       "      <td>-0.627154</td>\n",
       "      <td>1.354409</td>\n",
       "      <td>-0.832287</td>\n",
       "      <td>-0.413115</td>\n",
       "      <td>-0.559990</td>\n",
       "      <td>-0.510358</td>\n",
       "      <td>-0.305750</td>\n",
       "      <td>-0.224453</td>\n",
       "      <td>0.118743</td>\n",
       "      <td>1.807917</td>\n",
       "      <td>-0.494322</td>\n",
       "      <td>-0.548433</td>\n",
       "      <td>1.207205</td>\n",
       "      <td>0.296287</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7746</th>\n",
       "      <td>-2.458495</td>\n",
       "      <td>-0.654605</td>\n",
       "      <td>-0.991760</td>\n",
       "      <td>-0.611932</td>\n",
       "      <td>0.585186</td>\n",
       "      <td>-1.157541</td>\n",
       "      <td>-1.291164</td>\n",
       "      <td>-1.278051</td>\n",
       "      <td>-1.112273</td>\n",
       "      <td>-0.305750</td>\n",
       "      <td>-0.224453</td>\n",
       "      <td>-0.685654</td>\n",
       "      <td>1.191021</td>\n",
       "      <td>-0.735149</td>\n",
       "      <td>-0.820115</td>\n",
       "      <td>-2.096560</td>\n",
       "      <td>-0.728580</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7747</th>\n",
       "      <td>-2.187892</td>\n",
       "      <td>-1.328126</td>\n",
       "      <td>-1.112066</td>\n",
       "      <td>-0.436683</td>\n",
       "      <td>0.284622</td>\n",
       "      <td>-1.297018</td>\n",
       "      <td>-1.071078</td>\n",
       "      <td>-1.278054</td>\n",
       "      <td>-1.182118</td>\n",
       "      <td>-0.305750</td>\n",
       "      <td>-0.224453</td>\n",
       "      <td>-0.149390</td>\n",
       "      <td>-1.263971</td>\n",
       "      <td>-0.852681</td>\n",
       "      <td>-0.803915</td>\n",
       "      <td>-2.093040</td>\n",
       "      <td>-0.632499</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7748</th>\n",
       "      <td>-2.187892</td>\n",
       "      <td>-1.548184</td>\n",
       "      <td>-0.887662</td>\n",
       "      <td>-0.255421</td>\n",
       "      <td>-0.454749</td>\n",
       "      <td>-1.274658</td>\n",
       "      <td>-1.094726</td>\n",
       "      <td>-1.278054</td>\n",
       "      <td>-1.182118</td>\n",
       "      <td>-0.305750</td>\n",
       "      <td>-0.224453</td>\n",
       "      <td>-0.417522</td>\n",
       "      <td>-1.037356</td>\n",
       "      <td>-0.821213</td>\n",
       "      <td>-0.755095</td>\n",
       "      <td>-2.104553</td>\n",
       "      <td>-0.536418</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7749</th>\n",
       "      <td>-2.221718</td>\n",
       "      <td>-1.555342</td>\n",
       "      <td>-0.570780</td>\n",
       "      <td>0.088072</td>\n",
       "      <td>-1.591397</td>\n",
       "      <td>-1.224577</td>\n",
       "      <td>-1.153504</td>\n",
       "      <td>-1.278054</td>\n",
       "      <td>-1.178973</td>\n",
       "      <td>-0.305750</td>\n",
       "      <td>-0.224453</td>\n",
       "      <td>-0.417522</td>\n",
       "      <td>-0.269384</td>\n",
       "      <td>-0.779043</td>\n",
       "      <td>-0.719338</td>\n",
       "      <td>-2.074325</td>\n",
       "      <td>-0.792634</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7751</th>\n",
       "      <td>2.649126</td>\n",
       "      <td>1.624409</td>\n",
       "      <td>3.044561</td>\n",
       "      <td>6.792009</td>\n",
       "      <td>4.496044</td>\n",
       "      <td>2.291644</td>\n",
       "      <td>2.384303</td>\n",
       "      <td>2.670813</td>\n",
       "      <td>2.669002</td>\n",
       "      <td>11.935477</td>\n",
       "      <td>13.651790</td>\n",
       "      <td>1.991696</td>\n",
       "      <td>1.807917</td>\n",
       "      <td>2.772243</td>\n",
       "      <td>2.861435</td>\n",
       "      <td>1.517935</td>\n",
       "      <td>2.762374</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>7719 rows × 17 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      Present_Tmax  LDAPS_RHmax  LDAPS_Tmax_lapse  LDAPS_WS  LDAPS_LH  \\\n",
       "0        -0.361326     0.383078         -0.524889 -0.128382  0.206966   \n",
       "1         0.721084     0.311586          0.080895 -0.646994 -0.314841   \n",
       "2         0.619608    -0.614982          0.162936 -0.441604 -1.249283   \n",
       "3         0.754909     1.133054          0.031092 -0.666247  0.095997   \n",
       "4         0.551957     0.248765         -0.170325 -0.627154  1.354409   \n",
       "...            ...          ...               ...       ...       ...   \n",
       "7746     -2.458495    -0.654605         -0.991760 -0.611932  0.585186   \n",
       "7747     -2.187892    -1.328126         -1.112066 -0.436683  0.284622   \n",
       "7748     -2.187892    -1.548184         -0.887662 -0.255421 -0.454749   \n",
       "7749     -2.221718    -1.555342         -0.570780  0.088072 -1.591397   \n",
       "7751      2.649126     1.624409          3.044561  6.792009  4.496044   \n",
       "\n",
       "      LDAPS_CC1  LDAPS_CC2  LDAPS_CC3  LDAPS_CC4  LDAPS_PPT1  LDAPS_PPT4  \\\n",
       "0     -0.516243  -0.592636  -0.629013  -0.664815   -0.305750   -0.224453   \n",
       "1     -0.548557  -0.406199  -0.638055  -0.677462   -0.305750   -0.224453   \n",
       "2     -0.610450  -0.384009  -0.458843  -0.620575   -0.305750   -0.224453   \n",
       "3     -0.583539  -0.506548  -0.631178  -0.651696   -0.305750   -0.224453   \n",
       "4     -0.832287  -0.413115  -0.559990  -0.510358   -0.305750   -0.224453   \n",
       "...         ...        ...        ...        ...         ...         ...   \n",
       "7746  -1.157541  -1.291164  -1.278051  -1.112273   -0.305750   -0.224453   \n",
       "7747  -1.297018  -1.071078  -1.278054  -1.182118   -0.305750   -0.224453   \n",
       "7748  -1.274658  -1.094726  -1.278054  -1.182118   -0.305750   -0.224453   \n",
       "7749  -1.224577  -1.153504  -1.278054  -1.178973   -0.305750   -0.224453   \n",
       "7751   2.291644   2.384303   2.670813   2.669002   11.935477   13.651790   \n",
       "\n",
       "           lat       lon       DEM     Slope  Solar radiation  Next_Tmax  \n",
       "0     1.189286 -0.005000  2.772243  1.115004         1.517935  -0.376282  \n",
       "1     1.189286  0.511177 -0.315157 -0.542158         1.229950   0.072097  \n",
       "2     0.653021  0.838510 -0.526218 -0.723133         1.216534   0.264260  \n",
       "3     1.991696  0.385280 -0.297588  0.932424         1.201176   0.456422  \n",
       "4     0.118743  1.807917 -0.494322 -0.548433         1.207205   0.296287  \n",
       "...        ...       ...       ...       ...              ...        ...  \n",
       "7746 -0.685654  1.191021 -0.735149 -0.820115        -2.096560  -0.728580  \n",
       "7747 -0.149390 -1.263971 -0.852681 -0.803915        -2.093040  -0.632499  \n",
       "7748 -0.417522 -1.037356 -0.821213 -0.755095        -2.104553  -0.536418  \n",
       "7749 -0.417522 -0.269384 -0.779043 -0.719338        -2.074325  -0.792634  \n",
       "7751  1.991696  1.807917  2.772243  2.861435         1.517935   2.762374  \n",
       "\n",
       "[7719 rows x 17 columns]"
      ]
     },
     "execution_count": 96,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#####================寻找异常值====================######\n",
    "\n",
    "describe = ss_data['Next_Tmax'].describe()\n",
    "IQR = describe['75%']- describe['25%']\n",
    "lower_limit = describe['25%'] -1.5*IQR\n",
    "p = ss_data['Next_Tmax']>=lower_limit\n",
    "next_report = ss_data[p]\n",
    "next_report"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 98,
   "id": "80948117",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Present_Tmax</th>\n",
       "      <th>LDAPS_RHmax</th>\n",
       "      <th>LDAPS_Tmax_lapse</th>\n",
       "      <th>LDAPS_WS</th>\n",
       "      <th>LDAPS_LH</th>\n",
       "      <th>LDAPS_CC1</th>\n",
       "      <th>LDAPS_CC2</th>\n",
       "      <th>LDAPS_CC3</th>\n",
       "      <th>LDAPS_CC4</th>\n",
       "      <th>LDAPS_PPT1</th>\n",
       "      <th>LDAPS_PPT4</th>\n",
       "      <th>lat</th>\n",
       "      <th>lon</th>\n",
       "      <th>DEM</th>\n",
       "      <th>Slope</th>\n",
       "      <th>Solar radiation</th>\n",
       "      <th>Next_Tmax</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2650</th>\n",
       "      <td>-2.086416</td>\n",
       "      <td>1.146897</td>\n",
       "      <td>-2.217884</td>\n",
       "      <td>-1.247235</td>\n",
       "      <td>-0.404519</td>\n",
       "      <td>1.025171</td>\n",
       "      <td>1.294520</td>\n",
       "      <td>0.671912</td>\n",
       "      <td>0.915515</td>\n",
       "      <td>-0.086042</td>\n",
       "      <td>-0.224453</td>\n",
       "      <td>1.189286</td>\n",
       "      <td>-0.005000</td>\n",
       "      <td>2.772243</td>\n",
       "      <td>1.115004</td>\n",
       "      <td>-0.295389</td>\n",
       "      <td>-2.938450</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2750</th>\n",
       "      <td>-2.086416</td>\n",
       "      <td>0.722336</td>\n",
       "      <td>-2.347124</td>\n",
       "      <td>0.720893</td>\n",
       "      <td>0.431804</td>\n",
       "      <td>0.990499</td>\n",
       "      <td>1.166849</td>\n",
       "      <td>1.394751</td>\n",
       "      <td>2.292510</td>\n",
       "      <td>-0.188155</td>\n",
       "      <td>3.329386</td>\n",
       "      <td>1.189286</td>\n",
       "      <td>-0.005000</td>\n",
       "      <td>2.772243</td>\n",
       "      <td>1.115004</td>\n",
       "      <td>-0.592600</td>\n",
       "      <td>-3.002504</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5025</th>\n",
       "      <td>-1.443736</td>\n",
       "      <td>1.297482</td>\n",
       "      <td>-2.698896</td>\n",
       "      <td>3.154805</td>\n",
       "      <td>0.682660</td>\n",
       "      <td>1.256502</td>\n",
       "      <td>1.666250</td>\n",
       "      <td>1.293021</td>\n",
       "      <td>0.393944</td>\n",
       "      <td>-0.067187</td>\n",
       "      <td>0.123279</td>\n",
       "      <td>1.189286</td>\n",
       "      <td>-0.005000</td>\n",
       "      <td>2.772243</td>\n",
       "      <td>1.115004</td>\n",
       "      <td>1.165416</td>\n",
       "      <td>-3.066558</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5026</th>\n",
       "      <td>-0.564278</td>\n",
       "      <td>1.141629</td>\n",
       "      <td>-2.189783</td>\n",
       "      <td>0.265648</td>\n",
       "      <td>-0.153150</td>\n",
       "      <td>1.590055</td>\n",
       "      <td>1.613945</td>\n",
       "      <td>1.371150</td>\n",
       "      <td>0.589398</td>\n",
       "      <td>-0.085760</td>\n",
       "      <td>0.215901</td>\n",
       "      <td>1.189286</td>\n",
       "      <td>0.511177</td>\n",
       "      <td>-0.315157</td>\n",
       "      <td>-0.542158</td>\n",
       "      <td>0.865895</td>\n",
       "      <td>-2.810342</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5050</th>\n",
       "      <td>-3.067350</td>\n",
       "      <td>1.585246</td>\n",
       "      <td>-2.476358</td>\n",
       "      <td>1.396136</td>\n",
       "      <td>-0.782847</td>\n",
       "      <td>0.501491</td>\n",
       "      <td>-0.052399</td>\n",
       "      <td>-0.043444</td>\n",
       "      <td>0.101308</td>\n",
       "      <td>0.072443</td>\n",
       "      <td>-0.138037</td>\n",
       "      <td>1.189286</td>\n",
       "      <td>-0.005000</td>\n",
       "      <td>2.772243</td>\n",
       "      <td>1.115004</td>\n",
       "      <td>1.131952</td>\n",
       "      <td>-3.066558</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6100</th>\n",
       "      <td>-1.646687</td>\n",
       "      <td>0.457765</td>\n",
       "      <td>-2.310616</td>\n",
       "      <td>1.833989</td>\n",
       "      <td>1.489480</td>\n",
       "      <td>1.192236</td>\n",
       "      <td>0.211053</td>\n",
       "      <td>0.341799</td>\n",
       "      <td>1.351480</td>\n",
       "      <td>-0.204227</td>\n",
       "      <td>0.056343</td>\n",
       "      <td>1.189286</td>\n",
       "      <td>-0.005000</td>\n",
       "      <td>2.772243</td>\n",
       "      <td>1.115004</td>\n",
       "      <td>-1.511327</td>\n",
       "      <td>-3.034531</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6175</th>\n",
       "      <td>-2.695272</td>\n",
       "      <td>1.457979</td>\n",
       "      <td>-4.087857</td>\n",
       "      <td>4.911091</td>\n",
       "      <td>-0.210420</td>\n",
       "      <td>1.489658</td>\n",
       "      <td>2.281600</td>\n",
       "      <td>2.656311</td>\n",
       "      <td>2.268567</td>\n",
       "      <td>-0.017489</td>\n",
       "      <td>1.340116</td>\n",
       "      <td>1.189286</td>\n",
       "      <td>-0.005000</td>\n",
       "      <td>2.772243</td>\n",
       "      <td>1.115004</td>\n",
       "      <td>-1.786106</td>\n",
       "      <td>-4.123453</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6176</th>\n",
       "      <td>-2.086416</td>\n",
       "      <td>0.517310</td>\n",
       "      <td>-3.535766</td>\n",
       "      <td>4.003889</td>\n",
       "      <td>1.463660</td>\n",
       "      <td>0.894764</td>\n",
       "      <td>1.277177</td>\n",
       "      <td>2.148085</td>\n",
       "      <td>1.600057</td>\n",
       "      <td>0.084708</td>\n",
       "      <td>2.187907</td>\n",
       "      <td>1.189286</td>\n",
       "      <td>0.511177</td>\n",
       "      <td>-0.315157</td>\n",
       "      <td>-0.542158</td>\n",
       "      <td>-2.138584</td>\n",
       "      <td>-3.258721</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6177</th>\n",
       "      <td>-1.815814</td>\n",
       "      <td>0.293287</td>\n",
       "      <td>-3.323528</td>\n",
       "      <td>3.380546</td>\n",
       "      <td>0.732305</td>\n",
       "      <td>1.483952</td>\n",
       "      <td>1.747604</td>\n",
       "      <td>2.166054</td>\n",
       "      <td>1.581048</td>\n",
       "      <td>-0.091321</td>\n",
       "      <td>1.378723</td>\n",
       "      <td>0.653021</td>\n",
       "      <td>0.838510</td>\n",
       "      <td>-0.526218</td>\n",
       "      <td>-0.723133</td>\n",
       "      <td>-2.150110</td>\n",
       "      <td>-3.194667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6178</th>\n",
       "      <td>-1.815814</td>\n",
       "      <td>1.381461</td>\n",
       "      <td>-3.854778</td>\n",
       "      <td>5.508391</td>\n",
       "      <td>1.053051</td>\n",
       "      <td>1.129946</td>\n",
       "      <td>2.138966</td>\n",
       "      <td>2.557734</td>\n",
       "      <td>1.943433</td>\n",
       "      <td>0.196184</td>\n",
       "      <td>1.718829</td>\n",
       "      <td>1.991696</td>\n",
       "      <td>0.385280</td>\n",
       "      <td>-0.297588</td>\n",
       "      <td>0.932424</td>\n",
       "      <td>-2.174068</td>\n",
       "      <td>-3.098586</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6179</th>\n",
       "      <td>-1.748163</td>\n",
       "      <td>0.540625</td>\n",
       "      <td>-3.180434</td>\n",
       "      <td>2.709573</td>\n",
       "      <td>0.667897</td>\n",
       "      <td>1.427806</td>\n",
       "      <td>2.207221</td>\n",
       "      <td>2.466783</td>\n",
       "      <td>1.705215</td>\n",
       "      <td>-0.208367</td>\n",
       "      <td>1.190854</td>\n",
       "      <td>0.118743</td>\n",
       "      <td>1.807917</td>\n",
       "      <td>-0.494322</td>\n",
       "      <td>-0.548433</td>\n",
       "      <td>-2.181193</td>\n",
       "      <td>-3.194667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6180</th>\n",
       "      <td>-1.849639</td>\n",
       "      <td>0.291101</td>\n",
       "      <td>-3.008869</td>\n",
       "      <td>3.443116</td>\n",
       "      <td>0.875766</td>\n",
       "      <td>1.527562</td>\n",
       "      <td>2.186085</td>\n",
       "      <td>2.380435</td>\n",
       "      <td>1.732806</td>\n",
       "      <td>-0.111499</td>\n",
       "      <td>0.530213</td>\n",
       "      <td>-0.685654</td>\n",
       "      <td>0.637074</td>\n",
       "      <td>-0.133199</td>\n",
       "      <td>-0.810993</td>\n",
       "      <td>-2.150112</td>\n",
       "      <td>-2.906423</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6181</th>\n",
       "      <td>-2.086416</td>\n",
       "      <td>0.726924</td>\n",
       "      <td>-3.416935</td>\n",
       "      <td>3.153251</td>\n",
       "      <td>1.033799</td>\n",
       "      <td>1.484045</td>\n",
       "      <td>2.193447</td>\n",
       "      <td>2.587556</td>\n",
       "      <td>2.013460</td>\n",
       "      <td>-0.123314</td>\n",
       "      <td>0.618552</td>\n",
       "      <td>0.653021</td>\n",
       "      <td>-1.931225</td>\n",
       "      <td>-0.911963</td>\n",
       "      <td>-0.845437</td>\n",
       "      <td>-2.193176</td>\n",
       "      <td>-3.034531</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6182</th>\n",
       "      <td>-1.849639</td>\n",
       "      <td>0.128079</td>\n",
       "      <td>-2.987955</td>\n",
       "      <td>3.182614</td>\n",
       "      <td>0.539878</td>\n",
       "      <td>1.737777</td>\n",
       "      <td>2.324832</td>\n",
       "      <td>2.536665</td>\n",
       "      <td>1.386484</td>\n",
       "      <td>0.099575</td>\n",
       "      <td>0.452257</td>\n",
       "      <td>-1.490051</td>\n",
       "      <td>-1.024766</td>\n",
       "      <td>-0.172266</td>\n",
       "      <td>0.223191</td>\n",
       "      <td>-2.197299</td>\n",
       "      <td>-2.970477</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6183</th>\n",
       "      <td>-1.883465</td>\n",
       "      <td>0.559954</td>\n",
       "      <td>-3.090460</td>\n",
       "      <td>3.785644</td>\n",
       "      <td>0.588896</td>\n",
       "      <td>1.794153</td>\n",
       "      <td>2.241939</td>\n",
       "      <td>2.621514</td>\n",
       "      <td>1.616357</td>\n",
       "      <td>0.058270</td>\n",
       "      <td>0.359513</td>\n",
       "      <td>-0.953787</td>\n",
       "      <td>-2.082302</td>\n",
       "      <td>-0.201502</td>\n",
       "      <td>-0.616299</td>\n",
       "      <td>-2.121602</td>\n",
       "      <td>-3.066558</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6184</th>\n",
       "      <td>-2.390844</td>\n",
       "      <td>0.548491</td>\n",
       "      <td>-3.356360</td>\n",
       "      <td>3.778144</td>\n",
       "      <td>0.340973</td>\n",
       "      <td>1.722154</td>\n",
       "      <td>2.379023</td>\n",
       "      <td>2.612524</td>\n",
       "      <td>1.583916</td>\n",
       "      <td>0.143382</td>\n",
       "      <td>0.585596</td>\n",
       "      <td>-1.758184</td>\n",
       "      <td>-0.458230</td>\n",
       "      <td>2.701715</td>\n",
       "      <td>2.861413</td>\n",
       "      <td>-2.358212</td>\n",
       "      <td>-3.194667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6185</th>\n",
       "      <td>-1.748163</td>\n",
       "      <td>0.073370</td>\n",
       "      <td>-2.977437</td>\n",
       "      <td>2.994312</td>\n",
       "      <td>0.760935</td>\n",
       "      <td>1.561845</td>\n",
       "      <td>2.072250</td>\n",
       "      <td>2.185478</td>\n",
       "      <td>1.552148</td>\n",
       "      <td>-0.177150</td>\n",
       "      <td>0.826247</td>\n",
       "      <td>-0.149390</td>\n",
       "      <td>1.178432</td>\n",
       "      <td>-0.611095</td>\n",
       "      <td>-0.462470</td>\n",
       "      <td>-2.131853</td>\n",
       "      <td>-3.066558</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6186</th>\n",
       "      <td>-2.357019</td>\n",
       "      <td>0.397078</td>\n",
       "      <td>-3.309947</td>\n",
       "      <td>3.641401</td>\n",
       "      <td>0.469220</td>\n",
       "      <td>1.452282</td>\n",
       "      <td>2.096269</td>\n",
       "      <td>2.496450</td>\n",
       "      <td>1.974161</td>\n",
       "      <td>-0.132036</td>\n",
       "      <td>0.559798</td>\n",
       "      <td>0.118743</td>\n",
       "      <td>-0.042770</td>\n",
       "      <td>1.294304</td>\n",
       "      <td>-0.484508</td>\n",
       "      <td>-2.046890</td>\n",
       "      <td>-3.739128</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6187</th>\n",
       "      <td>-1.815814</td>\n",
       "      <td>0.203483</td>\n",
       "      <td>-3.346815</td>\n",
       "      <td>2.572588</td>\n",
       "      <td>0.430980</td>\n",
       "      <td>1.597681</td>\n",
       "      <td>1.913452</td>\n",
       "      <td>2.183086</td>\n",
       "      <td>1.684987</td>\n",
       "      <td>-0.163895</td>\n",
       "      <td>1.556727</td>\n",
       "      <td>0.653021</td>\n",
       "      <td>1.153252</td>\n",
       "      <td>-0.037504</td>\n",
       "      <td>1.043125</td>\n",
       "      <td>-2.208229</td>\n",
       "      <td>-3.130613</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6188</th>\n",
       "      <td>-1.917290</td>\n",
       "      <td>0.196464</td>\n",
       "      <td>-2.927473</td>\n",
       "      <td>3.375313</td>\n",
       "      <td>0.684771</td>\n",
       "      <td>1.560831</td>\n",
       "      <td>2.231691</td>\n",
       "      <td>2.590861</td>\n",
       "      <td>1.712657</td>\n",
       "      <td>-0.069786</td>\n",
       "      <td>0.474994</td>\n",
       "      <td>-0.953787</td>\n",
       "      <td>-0.810742</td>\n",
       "      <td>-0.569309</td>\n",
       "      <td>-0.466338</td>\n",
       "      <td>-2.181012</td>\n",
       "      <td>-2.938450</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6189</th>\n",
       "      <td>-1.748163</td>\n",
       "      <td>0.335249</td>\n",
       "      <td>-3.121586</td>\n",
       "      <td>3.246297</td>\n",
       "      <td>0.445623</td>\n",
       "      <td>1.492428</td>\n",
       "      <td>2.204697</td>\n",
       "      <td>2.533502</td>\n",
       "      <td>1.996110</td>\n",
       "      <td>-0.150345</td>\n",
       "      <td>0.469066</td>\n",
       "      <td>0.118743</td>\n",
       "      <td>-0.684844</td>\n",
       "      <td>-0.586289</td>\n",
       "      <td>-0.293244</td>\n",
       "      <td>-2.122811</td>\n",
       "      <td>-3.162640</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6190</th>\n",
       "      <td>-2.052591</td>\n",
       "      <td>0.342238</td>\n",
       "      <td>-3.133392</td>\n",
       "      <td>3.608837</td>\n",
       "      <td>0.689004</td>\n",
       "      <td>1.649470</td>\n",
       "      <td>2.317912</td>\n",
       "      <td>2.603041</td>\n",
       "      <td>1.430013</td>\n",
       "      <td>-0.014496</td>\n",
       "      <td>0.546835</td>\n",
       "      <td>-1.490051</td>\n",
       "      <td>0.045358</td>\n",
       "      <td>0.376283</td>\n",
       "      <td>0.730359</td>\n",
       "      <td>-2.274529</td>\n",
       "      <td>-3.066558</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6191</th>\n",
       "      <td>-2.018766</td>\n",
       "      <td>0.443371</td>\n",
       "      <td>-3.559795</td>\n",
       "      <td>2.056200</td>\n",
       "      <td>0.187604</td>\n",
       "      <td>1.580071</td>\n",
       "      <td>2.165352</td>\n",
       "      <td>2.341953</td>\n",
       "      <td>2.004631</td>\n",
       "      <td>-0.191814</td>\n",
       "      <td>2.098272</td>\n",
       "      <td>1.457418</td>\n",
       "      <td>1.354688</td>\n",
       "      <td>-0.154704</td>\n",
       "      <td>-0.408689</td>\n",
       "      <td>-2.146457</td>\n",
       "      <td>-3.386829</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6193</th>\n",
       "      <td>-1.781989</td>\n",
       "      <td>0.683279</td>\n",
       "      <td>-3.546341</td>\n",
       "      <td>3.042051</td>\n",
       "      <td>0.351990</td>\n",
       "      <td>1.475464</td>\n",
       "      <td>2.204002</td>\n",
       "      <td>2.544886</td>\n",
       "      <td>2.064549</td>\n",
       "      <td>-0.164838</td>\n",
       "      <td>0.821398</td>\n",
       "      <td>0.653021</td>\n",
       "      <td>-0.672255</td>\n",
       "      <td>0.243650</td>\n",
       "      <td>0.372715</td>\n",
       "      <td>-2.064552</td>\n",
       "      <td>-3.643046</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6194</th>\n",
       "      <td>-1.917290</td>\n",
       "      <td>1.544363</td>\n",
       "      <td>-4.016045</td>\n",
       "      <td>5.989302</td>\n",
       "      <td>-0.963308</td>\n",
       "      <td>1.394206</td>\n",
       "      <td>2.330022</td>\n",
       "      <td>2.670813</td>\n",
       "      <td>2.371793</td>\n",
       "      <td>0.122695</td>\n",
       "      <td>1.598140</td>\n",
       "      <td>1.457418</td>\n",
       "      <td>0.158666</td>\n",
       "      <td>1.560277</td>\n",
       "      <td>2.534052</td>\n",
       "      <td>-1.925129</td>\n",
       "      <td>-3.450884</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6195</th>\n",
       "      <td>-1.984940</td>\n",
       "      <td>0.181415</td>\n",
       "      <td>-3.033073</td>\n",
       "      <td>3.594376</td>\n",
       "      <td>0.729578</td>\n",
       "      <td>1.494870</td>\n",
       "      <td>1.970933</td>\n",
       "      <td>2.330075</td>\n",
       "      <td>1.676683</td>\n",
       "      <td>-0.125777</td>\n",
       "      <td>0.724950</td>\n",
       "      <td>0.118743</td>\n",
       "      <td>0.611895</td>\n",
       "      <td>-0.655350</td>\n",
       "      <td>-0.499833</td>\n",
       "      <td>-2.156557</td>\n",
       "      <td>-2.970477</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6196</th>\n",
       "      <td>-1.815814</td>\n",
       "      <td>0.273083</td>\n",
       "      <td>-2.951532</td>\n",
       "      <td>3.104686</td>\n",
       "      <td>0.981366</td>\n",
       "      <td>1.602459</td>\n",
       "      <td>2.125604</td>\n",
       "      <td>2.416907</td>\n",
       "      <td>1.457133</td>\n",
       "      <td>-0.151949</td>\n",
       "      <td>0.611140</td>\n",
       "      <td>-0.685654</td>\n",
       "      <td>1.191021</td>\n",
       "      <td>-0.735149</td>\n",
       "      <td>-0.820115</td>\n",
       "      <td>-2.190000</td>\n",
       "      <td>-2.842369</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6197</th>\n",
       "      <td>-1.680513</td>\n",
       "      <td>0.353661</td>\n",
       "      <td>-3.003557</td>\n",
       "      <td>3.407620</td>\n",
       "      <td>0.675525</td>\n",
       "      <td>1.534201</td>\n",
       "      <td>2.312147</td>\n",
       "      <td>2.602183</td>\n",
       "      <td>2.024745</td>\n",
       "      <td>-0.092121</td>\n",
       "      <td>0.400733</td>\n",
       "      <td>-0.149390</td>\n",
       "      <td>-1.263971</td>\n",
       "      <td>-0.852681</td>\n",
       "      <td>-0.803915</td>\n",
       "      <td>-2.186347</td>\n",
       "      <td>-2.906423</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6198</th>\n",
       "      <td>-1.680513</td>\n",
       "      <td>0.220089</td>\n",
       "      <td>-2.929177</td>\n",
       "      <td>3.410922</td>\n",
       "      <td>0.694940</td>\n",
       "      <td>1.498068</td>\n",
       "      <td>2.302101</td>\n",
       "      <td>2.556029</td>\n",
       "      <td>1.916674</td>\n",
       "      <td>-0.097121</td>\n",
       "      <td>0.454645</td>\n",
       "      <td>-0.417522</td>\n",
       "      <td>-1.037356</td>\n",
       "      <td>-0.821213</td>\n",
       "      <td>-0.755095</td>\n",
       "      <td>-2.198020</td>\n",
       "      <td>-2.938450</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6199</th>\n",
       "      <td>-1.883465</td>\n",
       "      <td>0.225614</td>\n",
       "      <td>-2.937813</td>\n",
       "      <td>3.387032</td>\n",
       "      <td>0.635237</td>\n",
       "      <td>1.499937</td>\n",
       "      <td>2.102797</td>\n",
       "      <td>2.516695</td>\n",
       "      <td>1.838733</td>\n",
       "      <td>-0.120700</td>\n",
       "      <td>0.500970</td>\n",
       "      <td>-0.417522</td>\n",
       "      <td>-0.269384</td>\n",
       "      <td>-0.779043</td>\n",
       "      <td>-0.719338</td>\n",
       "      <td>-2.167465</td>\n",
       "      <td>-2.938450</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7675</th>\n",
       "      <td>-2.221718</td>\n",
       "      <td>0.061175</td>\n",
       "      <td>-2.850518</td>\n",
       "      <td>3.165786</td>\n",
       "      <td>2.037223</td>\n",
       "      <td>0.014291</td>\n",
       "      <td>-1.059738</td>\n",
       "      <td>-1.063356</td>\n",
       "      <td>-0.784703</td>\n",
       "      <td>-0.305750</td>\n",
       "      <td>-0.224453</td>\n",
       "      <td>1.189286</td>\n",
       "      <td>-0.005000</td>\n",
       "      <td>2.772243</td>\n",
       "      <td>1.115004</td>\n",
       "      <td>-1.511327</td>\n",
       "      <td>-3.034531</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7700</th>\n",
       "      <td>-3.202651</td>\n",
       "      <td>-0.069554</td>\n",
       "      <td>-3.181468</td>\n",
       "      <td>-0.296906</td>\n",
       "      <td>0.184863</td>\n",
       "      <td>0.946993</td>\n",
       "      <td>1.139885</td>\n",
       "      <td>0.571433</td>\n",
       "      <td>-0.817978</td>\n",
       "      <td>-0.305750</td>\n",
       "      <td>-0.224453</td>\n",
       "      <td>1.189286</td>\n",
       "      <td>-0.005000</td>\n",
       "      <td>2.772243</td>\n",
       "      <td>1.115004</td>\n",
       "      <td>-1.601879</td>\n",
       "      <td>-3.162640</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7750</th>\n",
       "      <td>-3.304127</td>\n",
       "      <td>-4.113443</td>\n",
       "      <td>-4.087857</td>\n",
       "      <td>-1.939757</td>\n",
       "      <td>-2.267499</td>\n",
       "      <td>-1.412018</td>\n",
       "      <td>-1.386643</td>\n",
       "      <td>-1.278054</td>\n",
       "      <td>-1.182118</td>\n",
       "      <td>-0.305750</td>\n",
       "      <td>-0.224453</td>\n",
       "      <td>-1.758184</td>\n",
       "      <td>-2.082302</td>\n",
       "      <td>-0.911963</td>\n",
       "      <td>-0.845455</td>\n",
       "      <td>-2.358212</td>\n",
       "      <td>-4.123453</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      Present_Tmax  LDAPS_RHmax  LDAPS_Tmax_lapse  LDAPS_WS  LDAPS_LH  \\\n",
       "2650     -2.086416     1.146897         -2.217884 -1.247235 -0.404519   \n",
       "2750     -2.086416     0.722336         -2.347124  0.720893  0.431804   \n",
       "5025     -1.443736     1.297482         -2.698896  3.154805  0.682660   \n",
       "5026     -0.564278     1.141629         -2.189783  0.265648 -0.153150   \n",
       "5050     -3.067350     1.585246         -2.476358  1.396136 -0.782847   \n",
       "6100     -1.646687     0.457765         -2.310616  1.833989  1.489480   \n",
       "6175     -2.695272     1.457979         -4.087857  4.911091 -0.210420   \n",
       "6176     -2.086416     0.517310         -3.535766  4.003889  1.463660   \n",
       "6177     -1.815814     0.293287         -3.323528  3.380546  0.732305   \n",
       "6178     -1.815814     1.381461         -3.854778  5.508391  1.053051   \n",
       "6179     -1.748163     0.540625         -3.180434  2.709573  0.667897   \n",
       "6180     -1.849639     0.291101         -3.008869  3.443116  0.875766   \n",
       "6181     -2.086416     0.726924         -3.416935  3.153251  1.033799   \n",
       "6182     -1.849639     0.128079         -2.987955  3.182614  0.539878   \n",
       "6183     -1.883465     0.559954         -3.090460  3.785644  0.588896   \n",
       "6184     -2.390844     0.548491         -3.356360  3.778144  0.340973   \n",
       "6185     -1.748163     0.073370         -2.977437  2.994312  0.760935   \n",
       "6186     -2.357019     0.397078         -3.309947  3.641401  0.469220   \n",
       "6187     -1.815814     0.203483         -3.346815  2.572588  0.430980   \n",
       "6188     -1.917290     0.196464         -2.927473  3.375313  0.684771   \n",
       "6189     -1.748163     0.335249         -3.121586  3.246297  0.445623   \n",
       "6190     -2.052591     0.342238         -3.133392  3.608837  0.689004   \n",
       "6191     -2.018766     0.443371         -3.559795  2.056200  0.187604   \n",
       "6193     -1.781989     0.683279         -3.546341  3.042051  0.351990   \n",
       "6194     -1.917290     1.544363         -4.016045  5.989302 -0.963308   \n",
       "6195     -1.984940     0.181415         -3.033073  3.594376  0.729578   \n",
       "6196     -1.815814     0.273083         -2.951532  3.104686  0.981366   \n",
       "6197     -1.680513     0.353661         -3.003557  3.407620  0.675525   \n",
       "6198     -1.680513     0.220089         -2.929177  3.410922  0.694940   \n",
       "6199     -1.883465     0.225614         -2.937813  3.387032  0.635237   \n",
       "7675     -2.221718     0.061175         -2.850518  3.165786  2.037223   \n",
       "7700     -3.202651    -0.069554         -3.181468 -0.296906  0.184863   \n",
       "7750     -3.304127    -4.113443         -4.087857 -1.939757 -2.267499   \n",
       "\n",
       "      LDAPS_CC1  LDAPS_CC2  LDAPS_CC3  LDAPS_CC4  LDAPS_PPT1  LDAPS_PPT4  \\\n",
       "2650   1.025171   1.294520   0.671912   0.915515   -0.086042   -0.224453   \n",
       "2750   0.990499   1.166849   1.394751   2.292510   -0.188155    3.329386   \n",
       "5025   1.256502   1.666250   1.293021   0.393944   -0.067187    0.123279   \n",
       "5026   1.590055   1.613945   1.371150   0.589398   -0.085760    0.215901   \n",
       "5050   0.501491  -0.052399  -0.043444   0.101308    0.072443   -0.138037   \n",
       "6100   1.192236   0.211053   0.341799   1.351480   -0.204227    0.056343   \n",
       "6175   1.489658   2.281600   2.656311   2.268567   -0.017489    1.340116   \n",
       "6176   0.894764   1.277177   2.148085   1.600057    0.084708    2.187907   \n",
       "6177   1.483952   1.747604   2.166054   1.581048   -0.091321    1.378723   \n",
       "6178   1.129946   2.138966   2.557734   1.943433    0.196184    1.718829   \n",
       "6179   1.427806   2.207221   2.466783   1.705215   -0.208367    1.190854   \n",
       "6180   1.527562   2.186085   2.380435   1.732806   -0.111499    0.530213   \n",
       "6181   1.484045   2.193447   2.587556   2.013460   -0.123314    0.618552   \n",
       "6182   1.737777   2.324832   2.536665   1.386484    0.099575    0.452257   \n",
       "6183   1.794153   2.241939   2.621514   1.616357    0.058270    0.359513   \n",
       "6184   1.722154   2.379023   2.612524   1.583916    0.143382    0.585596   \n",
       "6185   1.561845   2.072250   2.185478   1.552148   -0.177150    0.826247   \n",
       "6186   1.452282   2.096269   2.496450   1.974161   -0.132036    0.559798   \n",
       "6187   1.597681   1.913452   2.183086   1.684987   -0.163895    1.556727   \n",
       "6188   1.560831   2.231691   2.590861   1.712657   -0.069786    0.474994   \n",
       "6189   1.492428   2.204697   2.533502   1.996110   -0.150345    0.469066   \n",
       "6190   1.649470   2.317912   2.603041   1.430013   -0.014496    0.546835   \n",
       "6191   1.580071   2.165352   2.341953   2.004631   -0.191814    2.098272   \n",
       "6193   1.475464   2.204002   2.544886   2.064549   -0.164838    0.821398   \n",
       "6194   1.394206   2.330022   2.670813   2.371793    0.122695    1.598140   \n",
       "6195   1.494870   1.970933   2.330075   1.676683   -0.125777    0.724950   \n",
       "6196   1.602459   2.125604   2.416907   1.457133   -0.151949    0.611140   \n",
       "6197   1.534201   2.312147   2.602183   2.024745   -0.092121    0.400733   \n",
       "6198   1.498068   2.302101   2.556029   1.916674   -0.097121    0.454645   \n",
       "6199   1.499937   2.102797   2.516695   1.838733   -0.120700    0.500970   \n",
       "7675   0.014291  -1.059738  -1.063356  -0.784703   -0.305750   -0.224453   \n",
       "7700   0.946993   1.139885   0.571433  -0.817978   -0.305750   -0.224453   \n",
       "7750  -1.412018  -1.386643  -1.278054  -1.182118   -0.305750   -0.224453   \n",
       "\n",
       "           lat       lon       DEM     Slope  Solar radiation  Next_Tmax  \n",
       "2650  1.189286 -0.005000  2.772243  1.115004        -0.295389  -2.938450  \n",
       "2750  1.189286 -0.005000  2.772243  1.115004        -0.592600  -3.002504  \n",
       "5025  1.189286 -0.005000  2.772243  1.115004         1.165416  -3.066558  \n",
       "5026  1.189286  0.511177 -0.315157 -0.542158         0.865895  -2.810342  \n",
       "5050  1.189286 -0.005000  2.772243  1.115004         1.131952  -3.066558  \n",
       "6100  1.189286 -0.005000  2.772243  1.115004        -1.511327  -3.034531  \n",
       "6175  1.189286 -0.005000  2.772243  1.115004        -1.786106  -4.123453  \n",
       "6176  1.189286  0.511177 -0.315157 -0.542158        -2.138584  -3.258721  \n",
       "6177  0.653021  0.838510 -0.526218 -0.723133        -2.150110  -3.194667  \n",
       "6178  1.991696  0.385280 -0.297588  0.932424        -2.174068  -3.098586  \n",
       "6179  0.118743  1.807917 -0.494322 -0.548433        -2.181193  -3.194667  \n",
       "6180 -0.685654  0.637074 -0.133199 -0.810993        -2.150112  -2.906423  \n",
       "6181  0.653021 -1.931225 -0.911963 -0.845437        -2.193176  -3.034531  \n",
       "6182 -1.490051 -1.024766 -0.172266  0.223191        -2.197299  -2.970477  \n",
       "6183 -0.953787 -2.082302 -0.201502 -0.616299        -2.121602  -3.066558  \n",
       "6184 -1.758184 -0.458230  2.701715  2.861413        -2.358212  -3.194667  \n",
       "6185 -0.149390  1.178432 -0.611095 -0.462470        -2.131853  -3.066558  \n",
       "6186  0.118743 -0.042770  1.294304 -0.484508        -2.046890  -3.739128  \n",
       "6187  0.653021  1.153252 -0.037504  1.043125        -2.208229  -3.130613  \n",
       "6188 -0.953787 -0.810742 -0.569309 -0.466338        -2.181012  -2.938450  \n",
       "6189  0.118743 -0.684844 -0.586289 -0.293244        -2.122811  -3.162640  \n",
       "6190 -1.490051  0.045358  0.376283  0.730359        -2.274529  -3.066558  \n",
       "6191  1.457418  1.354688 -0.154704 -0.408689        -2.146457  -3.386829  \n",
       "6193  0.653021 -0.672255  0.243650  0.372715        -2.064552  -3.643046  \n",
       "6194  1.457418  0.158666  1.560277  2.534052        -1.925129  -3.450884  \n",
       "6195  0.118743  0.611895 -0.655350 -0.499833        -2.156557  -2.970477  \n",
       "6196 -0.685654  1.191021 -0.735149 -0.820115        -2.190000  -2.842369  \n",
       "6197 -0.149390 -1.263971 -0.852681 -0.803915        -2.186347  -2.906423  \n",
       "6198 -0.417522 -1.037356 -0.821213 -0.755095        -2.198020  -2.938450  \n",
       "6199 -0.417522 -0.269384 -0.779043 -0.719338        -2.167465  -2.938450  \n",
       "7675  1.189286 -0.005000  2.772243  1.115004        -1.511327  -3.034531  \n",
       "7700  1.189286 -0.005000  2.772243  1.115004        -1.601879  -3.162640  \n",
       "7750 -1.758184 -2.082302 -0.911963 -0.845455        -2.358212  -4.123453  "
      ]
     },
     "execution_count": 98,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "array([2650, 2750, 5025, 5026, 5050, 6100, 6175, 6176, 6177, 6178, 6179,\n",
       "       6180, 6181, 6182, 6183, 6184, 6185, 6186, 6187, 6188, 6189, 6190,\n",
       "       6191, 6193, 6194, 6195, 6196, 6197, 6198, 6199, 7675, 7700, 7750],\n",
       "      dtype=int64)"
      ]
     },
     "execution_count": 98,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Y中小于箱型图下边缘的值\n",
    "ss_data[ss_data['Next_Tmax']<lower_limit] \n",
    "# 要删除的样本的Index\n",
    "drop_index=ss_data[ss_data['Next_Tmax']<lower_limit].index.values\n",
    "drop_index"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 99,
   "id": "3a21dc15",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 删除Y中小于箱型图下边缘的值\n",
    "X=X.drop(drop_index)\n",
    "Y=Y.drop(drop_index) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 102,
   "id": "81090f87",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "LinearRegression()"
      ]
     },
     "execution_count": 102,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "MSE: 0.23653689423387364\n",
      "RMSE: 0.48635058777991996\n"
     ]
    }
   ],
   "source": [
    "import sklearn.metrics as metrics\n",
    "# 重新划分数据集\n",
    "X_train, X_test, Y_train, Y_test = train_test_split(X, Y, test_size=0.3, random_state=1)\n",
    "# 对训练集进行训练\n",
    "lr = LinearRegression()\n",
    "lr.fit(X_train, Y_train) \n",
    "# 对测试集进行预测\n",
    "Y_pred = lr.predict(X_test)\n",
    "MSE = metrics.mean_squared_error(Y_test, Y_pred)\n",
    "RMSE = np.sqrt(metrics.mean_squared_error(Y_test, Y_pred)) \n",
    "print('MSE:',MSE) \n",
    "print('RMSE:',RMSE) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 103,
   "id": "9d2e6cf9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "14"
      ]
     },
     "execution_count": 103,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 特征筛选，选出和样本标签之间存在显著相关性（p<0.05)的特征，从而过滤掉对模型预测贡献不大的特征\n",
    "from sklearn.feature_selection import f_regression\n",
    "\n",
    "F,p=f_regression(X,Y)  # 一个特征对应一个F值和p值\n",
    "k=F.shape[0] - (p>0.05).sum() # 去掉p值<=0.05的特征，k就是剩下的特征数量\n",
    "k "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 104,
   "id": "2b17cd2e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(7719, 14)"
      ]
     },
     "execution_count": 104,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "array([[-0.36132577,  0.38307796, -0.52488856, ...,  1.18928568,\n",
       "         2.77224286,  1.11500407],\n",
       "       [ 0.72108401,  0.31158619,  0.08089519, ...,  1.18928568,\n",
       "        -0.31515742, -0.54215762],\n",
       "       [ 0.61960809, -0.61498177,  0.16293647, ...,  0.65302103,\n",
       "        -0.52621832, -0.7231326 ],\n",
       "       ...,\n",
       "       [-2.18789227, -1.54818379, -0.88766178, ..., -0.41752209,\n",
       "        -0.82121274, -0.75509512],\n",
       "       [-2.22171758, -1.55534234, -0.57077984, ..., -0.41752209,\n",
       "        -0.77904331, -0.71933797],\n",
       "       [ 2.64912642,  1.62440928,  3.04456067, ...,  1.99169648,\n",
       "         2.77224286,  2.86143459]])"
      ]
     },
     "execution_count": 104,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# F检验筛选特征\n",
    "from sklearn.feature_selection import SelectKBest\n",
    "\n",
    "X_f=SelectKBest(f_regression,k=k).fit_transform(X,Y) \n",
    "X_f.shape    # 过滤掉了两个特征\n",
    "X_f"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 105,
   "id": "5888cb7f",
   "metadata": {},
   "outputs": [],
   "source": [
    "xtrain,xtest,ytrain,ytest=train_test_split(X_f,Y,test_size=0.3, random_state=1) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 106,
   "id": "21bcd244",
   "metadata": {},
   "outputs": [],
   "source": [
    "# # 实例化并训练模型\n",
    "lr=LinearRegression().fit(xtrain,ytrain) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 107,
   "id": "d11a1738",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "MSE: 0.24095547445500337\n",
      "RMSE: 0.4908721569360024\n"
     ]
    }
   ],
   "source": [
    "ypred = lr.predict(xtest) \n",
    "MSE = metrics.mean_squared_error(ytest, ypred)\n",
    "RMSE = np.sqrt(metrics.mean_squared_error(ytest, ypred)) \n",
    "print('MSE:',MSE) \n",
    "print('RMSE:',RMSE) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 108,
   "id": "bd518013",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.decomposition import PCA\n",
    "\n",
    "pca=PCA(n_components=0.97).fit(X,Y) \n",
    "X_pca=pca.transform(X)  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 109,
   "id": "e1a39f25",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>2</th>\n",
       "      <th>3</th>\n",
       "      <th>4</th>\n",
       "      <th>5</th>\n",
       "      <th>6</th>\n",
       "      <th>7</th>\n",
       "      <th>8</th>\n",
       "      <th>9</th>\n",
       "      <th>10</th>\n",
       "      <th>11</th>\n",
       "      <th>12</th>\n",
       "      <th>13</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>-0.188875</td>\n",
       "      <td>3.105274</td>\n",
       "      <td>-0.174420</td>\n",
       "      <td>0.232023</td>\n",
       "      <td>0.614357</td>\n",
       "      <td>-0.712495</td>\n",
       "      <td>-1.301660</td>\n",
       "      <td>-0.395921</td>\n",
       "      <td>0.169397</td>\n",
       "      <td>0.661308</td>\n",
       "      <td>-0.334142</td>\n",
       "      <td>0.350072</td>\n",
       "      <td>-0.427288</td>\n",
       "      <td>1.102016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>-1.041580</td>\n",
       "      <td>-0.102778</td>\n",
       "      <td>1.236504</td>\n",
       "      <td>0.435599</td>\n",
       "      <td>0.429038</td>\n",
       "      <td>-0.683036</td>\n",
       "      <td>-1.097555</td>\n",
       "      <td>-0.397473</td>\n",
       "      <td>-0.026081</td>\n",
       "      <td>0.502019</td>\n",
       "      <td>0.201790</td>\n",
       "      <td>-0.256293</td>\n",
       "      <td>-0.824149</td>\n",
       "      <td>0.247166</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>-1.122112</td>\n",
       "      <td>-0.891416</td>\n",
       "      <td>0.471348</td>\n",
       "      <td>0.462210</td>\n",
       "      <td>0.594114</td>\n",
       "      <td>-1.437138</td>\n",
       "      <td>-1.028615</td>\n",
       "      <td>0.193530</td>\n",
       "      <td>0.127245</td>\n",
       "      <td>0.225650</td>\n",
       "      <td>0.100329</td>\n",
       "      <td>-0.208413</td>\n",
       "      <td>-0.926234</td>\n",
       "      <td>0.177910</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>-0.787025</td>\n",
       "      <td>1.227941</td>\n",
       "      <td>1.628529</td>\n",
       "      <td>0.750534</td>\n",
       "      <td>0.480516</td>\n",
       "      <td>-0.491080</td>\n",
       "      <td>-0.976939</td>\n",
       "      <td>-0.864368</td>\n",
       "      <td>-0.227469</td>\n",
       "      <td>1.047950</td>\n",
       "      <td>0.419490</td>\n",
       "      <td>-0.490863</td>\n",
       "      <td>-0.845073</td>\n",
       "      <td>-0.677817</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>-1.181040</td>\n",
       "      <td>0.132213</td>\n",
       "      <td>1.700762</td>\n",
       "      <td>0.864334</td>\n",
       "      <td>0.305876</td>\n",
       "      <td>0.042785</td>\n",
       "      <td>-0.695446</td>\n",
       "      <td>-0.530648</td>\n",
       "      <td>0.390678</td>\n",
       "      <td>-1.373559</td>\n",
       "      <td>-0.684244</td>\n",
       "      <td>-0.126623</td>\n",
       "      <td>-0.934499</td>\n",
       "      <td>0.187668</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7714</th>\n",
       "      <td>-1.828045</td>\n",
       "      <td>0.204511</td>\n",
       "      <td>0.087075</td>\n",
       "      <td>-0.137277</td>\n",
       "      <td>-3.611235</td>\n",
       "      <td>-0.232090</td>\n",
       "      <td>0.198096</td>\n",
       "      <td>1.399704</td>\n",
       "      <td>0.710092</td>\n",
       "      <td>-1.356931</td>\n",
       "      <td>-0.861351</td>\n",
       "      <td>-0.014907</td>\n",
       "      <td>-0.133469</td>\n",
       "      <td>-0.036297</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7715</th>\n",
       "      <td>-1.917145</td>\n",
       "      <td>-0.185958</td>\n",
       "      <td>-0.908207</td>\n",
       "      <td>-0.975988</td>\n",
       "      <td>-3.522399</td>\n",
       "      <td>0.521996</td>\n",
       "      <td>-0.256674</td>\n",
       "      <td>1.343472</td>\n",
       "      <td>-0.246521</td>\n",
       "      <td>0.404696</td>\n",
       "      <td>-0.731927</td>\n",
       "      <td>0.547065</td>\n",
       "      <td>-0.274555</td>\n",
       "      <td>-0.114590</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7716</th>\n",
       "      <td>-1.945816</td>\n",
       "      <td>-0.417947</td>\n",
       "      <td>-1.306099</td>\n",
       "      <td>-1.002492</td>\n",
       "      <td>-3.298725</td>\n",
       "      <td>-0.026787</td>\n",
       "      <td>-0.182500</td>\n",
       "      <td>1.672442</td>\n",
       "      <td>-0.081839</td>\n",
       "      <td>0.324312</td>\n",
       "      <td>-0.520419</td>\n",
       "      <td>0.345995</td>\n",
       "      <td>-0.210014</td>\n",
       "      <td>-0.158449</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7717</th>\n",
       "      <td>-1.864801</td>\n",
       "      <td>-0.594864</td>\n",
       "      <td>-1.441804</td>\n",
       "      <td>-0.743734</td>\n",
       "      <td>-3.012536</td>\n",
       "      <td>-1.071030</td>\n",
       "      <td>-0.124629</td>\n",
       "      <td>2.227065</td>\n",
       "      <td>0.116584</td>\n",
       "      <td>0.182574</td>\n",
       "      <td>-0.114871</td>\n",
       "      <td>-0.153969</td>\n",
       "      <td>-0.112684</td>\n",
       "      <td>-0.181380</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7718</th>\n",
       "      <td>8.784503</td>\n",
       "      <td>3.163045</td>\n",
       "      <td>4.467119</td>\n",
       "      <td>4.805559</td>\n",
       "      <td>9.278716</td>\n",
       "      <td>8.369438</td>\n",
       "      <td>5.980771</td>\n",
       "      <td>9.079706</td>\n",
       "      <td>6.199409</td>\n",
       "      <td>3.802075</td>\n",
       "      <td>0.179508</td>\n",
       "      <td>1.663953</td>\n",
       "      <td>-0.335985</td>\n",
       "      <td>0.833460</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>7719 rows × 14 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "            0         1         2         3         4         5         6   \\\n",
       "0    -0.188875  3.105274 -0.174420  0.232023  0.614357 -0.712495 -1.301660   \n",
       "1    -1.041580 -0.102778  1.236504  0.435599  0.429038 -0.683036 -1.097555   \n",
       "2    -1.122112 -0.891416  0.471348  0.462210  0.594114 -1.437138 -1.028615   \n",
       "3    -0.787025  1.227941  1.628529  0.750534  0.480516 -0.491080 -0.976939   \n",
       "4    -1.181040  0.132213  1.700762  0.864334  0.305876  0.042785 -0.695446   \n",
       "...        ...       ...       ...       ...       ...       ...       ...   \n",
       "7714 -1.828045  0.204511  0.087075 -0.137277 -3.611235 -0.232090  0.198096   \n",
       "7715 -1.917145 -0.185958 -0.908207 -0.975988 -3.522399  0.521996 -0.256674   \n",
       "7716 -1.945816 -0.417947 -1.306099 -1.002492 -3.298725 -0.026787 -0.182500   \n",
       "7717 -1.864801 -0.594864 -1.441804 -0.743734 -3.012536 -1.071030 -0.124629   \n",
       "7718  8.784503  3.163045  4.467119  4.805559  9.278716  8.369438  5.980771   \n",
       "\n",
       "            7         8         9         10        11        12        13  \n",
       "0    -0.395921  0.169397  0.661308 -0.334142  0.350072 -0.427288  1.102016  \n",
       "1    -0.397473 -0.026081  0.502019  0.201790 -0.256293 -0.824149  0.247166  \n",
       "2     0.193530  0.127245  0.225650  0.100329 -0.208413 -0.926234  0.177910  \n",
       "3    -0.864368 -0.227469  1.047950  0.419490 -0.490863 -0.845073 -0.677817  \n",
       "4    -0.530648  0.390678 -1.373559 -0.684244 -0.126623 -0.934499  0.187668  \n",
       "...        ...       ...       ...       ...       ...       ...       ...  \n",
       "7714  1.399704  0.710092 -1.356931 -0.861351 -0.014907 -0.133469 -0.036297  \n",
       "7715  1.343472 -0.246521  0.404696 -0.731927  0.547065 -0.274555 -0.114590  \n",
       "7716  1.672442 -0.081839  0.324312 -0.520419  0.345995 -0.210014 -0.158449  \n",
       "7717  2.227065  0.116584  0.182574 -0.114871 -0.153969 -0.112684 -0.181380  \n",
       "7718  9.079706  6.199409  3.802075  0.179508  1.663953 -0.335985  0.833460  \n",
       "\n",
       "[7719 rows x 14 columns]"
      ]
     },
     "execution_count": 109,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X_pca=pd.DataFrame(X_pca)\n",
    "X_pca"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 110,
   "id": "192edb4a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>2</th>\n",
       "      <th>3</th>\n",
       "      <th>4</th>\n",
       "      <th>5</th>\n",
       "      <th>6</th>\n",
       "      <th>7</th>\n",
       "      <th>8</th>\n",
       "      <th>9</th>\n",
       "      <th>10</th>\n",
       "      <th>11</th>\n",
       "      <th>12</th>\n",
       "      <th>13</th>\n",
       "      <th>14</th>\n",
       "      <th>15</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>-0.222742</td>\n",
       "      <td>0.263311</td>\n",
       "      <td>-0.354324</td>\n",
       "      <td>0.201683</td>\n",
       "      <td>-0.104739</td>\n",
       "      <td>0.393294</td>\n",
       "      <td>0.422638</td>\n",
       "      <td>0.399707</td>\n",
       "      <td>0.344365</td>\n",
       "      <td>0.199209</td>\n",
       "      <td>0.161564</td>\n",
       "      <td>0.024391</td>\n",
       "      <td>-0.007817</td>\n",
       "      <td>0.075389</td>\n",
       "      <td>0.068689</td>\n",
       "      <td>0.123937</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>-0.176182</td>\n",
       "      <td>0.264489</td>\n",
       "      <td>-0.113884</td>\n",
       "      <td>0.138779</td>\n",
       "      <td>0.255222</td>\n",
       "      <td>-0.076576</td>\n",
       "      <td>-0.145124</td>\n",
       "      <td>-0.186183</td>\n",
       "      <td>-0.187085</td>\n",
       "      <td>0.005605</td>\n",
       "      <td>-0.060720</td>\n",
       "      <td>0.174841</td>\n",
       "      <td>0.062611</td>\n",
       "      <td>0.572606</td>\n",
       "      <td>0.582067</td>\n",
       "      <td>0.012661</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.035115</td>\n",
       "      <td>0.371731</td>\n",
       "      <td>0.122479</td>\n",
       "      <td>-0.090039</td>\n",
       "      <td>0.359309</td>\n",
       "      <td>0.196599</td>\n",
       "      <td>0.050196</td>\n",
       "      <td>-0.139835</td>\n",
       "      <td>-0.191900</td>\n",
       "      <td>0.303063</td>\n",
       "      <td>-0.086435</td>\n",
       "      <td>0.464752</td>\n",
       "      <td>0.363850</td>\n",
       "      <td>-0.293949</td>\n",
       "      <td>-0.242831</td>\n",
       "      <td>0.133229</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0.145043</td>\n",
       "      <td>-0.114328</td>\n",
       "      <td>0.010787</td>\n",
       "      <td>-0.022730</td>\n",
       "      <td>0.069970</td>\n",
       "      <td>-0.267264</td>\n",
       "      <td>-0.078085</td>\n",
       "      <td>0.237171</td>\n",
       "      <td>0.337363</td>\n",
       "      <td>-0.364178</td>\n",
       "      <td>0.459535</td>\n",
       "      <td>0.384470</td>\n",
       "      <td>0.459891</td>\n",
       "      <td>0.026564</td>\n",
       "      <td>0.064236</td>\n",
       "      <td>-0.069460</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0.553570</td>\n",
       "      <td>-0.119346</td>\n",
       "      <td>0.414334</td>\n",
       "      <td>0.270975</td>\n",
       "      <td>-0.021542</td>\n",
       "      <td>0.071159</td>\n",
       "      <td>0.067682</td>\n",
       "      <td>0.067230</td>\n",
       "      <td>0.081974</td>\n",
       "      <td>0.203411</td>\n",
       "      <td>0.014358</td>\n",
       "      <td>-0.091487</td>\n",
       "      <td>0.033391</td>\n",
       "      <td>0.157431</td>\n",
       "      <td>0.178319</td>\n",
       "      <td>0.552467</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>0.163904</td>\n",
       "      <td>0.208568</td>\n",
       "      <td>-0.055769</td>\n",
       "      <td>0.166646</td>\n",
       "      <td>0.630398</td>\n",
       "      <td>-0.084256</td>\n",
       "      <td>-0.115130</td>\n",
       "      <td>-0.009862</td>\n",
       "      <td>0.103554</td>\n",
       "      <td>0.013371</td>\n",
       "      <td>0.428871</td>\n",
       "      <td>-0.210514</td>\n",
       "      <td>-0.458194</td>\n",
       "      <td>-0.123691</td>\n",
       "      <td>-0.101349</td>\n",
       "      <td>-0.078992</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>0.365585</td>\n",
       "      <td>-0.052028</td>\n",
       "      <td>0.078648</td>\n",
       "      <td>-0.087867</td>\n",
       "      <td>0.051706</td>\n",
       "      <td>0.065798</td>\n",
       "      <td>0.109443</td>\n",
       "      <td>0.116339</td>\n",
       "      <td>0.064194</td>\n",
       "      <td>0.446661</td>\n",
       "      <td>-0.055199</td>\n",
       "      <td>-0.137450</td>\n",
       "      <td>0.193075</td>\n",
       "      <td>0.096424</td>\n",
       "      <td>0.172967</td>\n",
       "      <td>-0.717746</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>-0.265292</td>\n",
       "      <td>-0.279226</td>\n",
       "      <td>0.006281</td>\n",
       "      <td>0.658992</td>\n",
       "      <td>-0.181603</td>\n",
       "      <td>-0.010895</td>\n",
       "      <td>-0.189539</td>\n",
       "      <td>-0.228418</td>\n",
       "      <td>-0.142294</td>\n",
       "      <td>0.329392</td>\n",
       "      <td>0.325918</td>\n",
       "      <td>0.064108</td>\n",
       "      <td>0.143243</td>\n",
       "      <td>-0.070112</td>\n",
       "      <td>-0.129384</td>\n",
       "      <td>-0.122030</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>-0.260557</td>\n",
       "      <td>0.114002</td>\n",
       "      <td>0.184736</td>\n",
       "      <td>-0.514467</td>\n",
       "      <td>-0.118458</td>\n",
       "      <td>0.006525</td>\n",
       "      <td>-0.093250</td>\n",
       "      <td>-0.117852</td>\n",
       "      <td>-0.031030</td>\n",
       "      <td>0.280630</td>\n",
       "      <td>0.520935</td>\n",
       "      <td>-0.379582</td>\n",
       "      <td>0.203918</td>\n",
       "      <td>0.091311</td>\n",
       "      <td>0.059847</td>\n",
       "      <td>0.187024</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>0.039571</td>\n",
       "      <td>-0.005249</td>\n",
       "      <td>0.117088</td>\n",
       "      <td>-0.231484</td>\n",
       "      <td>-0.297357</td>\n",
       "      <td>-0.123173</td>\n",
       "      <td>-0.064410</td>\n",
       "      <td>0.011790</td>\n",
       "      <td>0.075488</td>\n",
       "      <td>0.310984</td>\n",
       "      <td>0.169668</td>\n",
       "      <td>0.599610</td>\n",
       "      <td>-0.569295</td>\n",
       "      <td>0.044760</td>\n",
       "      <td>0.071209</td>\n",
       "      <td>-0.036481</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>0.229190</td>\n",
       "      <td>0.369807</td>\n",
       "      <td>0.186680</td>\n",
       "      <td>0.122171</td>\n",
       "      <td>-0.328840</td>\n",
       "      <td>0.235760</td>\n",
       "      <td>0.282023</td>\n",
       "      <td>-0.140312</td>\n",
       "      <td>-0.417206</td>\n",
       "      <td>-0.404072</td>\n",
       "      <td>0.329369</td>\n",
       "      <td>0.011250</td>\n",
       "      <td>-0.061243</td>\n",
       "      <td>-0.032764</td>\n",
       "      <td>0.053543</td>\n",
       "      <td>-0.210616</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>-0.036390</td>\n",
       "      <td>-0.638793</td>\n",
       "      <td>-0.067746</td>\n",
       "      <td>-0.205118</td>\n",
       "      <td>0.325155</td>\n",
       "      <td>0.465504</td>\n",
       "      <td>0.256466</td>\n",
       "      <td>-0.075083</td>\n",
       "      <td>-0.236228</td>\n",
       "      <td>-0.094371</td>\n",
       "      <td>0.183414</td>\n",
       "      <td>0.155599</td>\n",
       "      <td>-0.077864</td>\n",
       "      <td>0.138497</td>\n",
       "      <td>0.042510</td>\n",
       "      <td>0.022637</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>-0.352690</td>\n",
       "      <td>0.055647</td>\n",
       "      <td>0.669917</td>\n",
       "      <td>0.084548</td>\n",
       "      <td>0.103422</td>\n",
       "      <td>0.320851</td>\n",
       "      <td>-0.078004</td>\n",
       "      <td>-0.062740</td>\n",
       "      <td>0.417550</td>\n",
       "      <td>-0.182148</td>\n",
       "      <td>-0.123814</td>\n",
       "      <td>0.028249</td>\n",
       "      <td>-0.074508</td>\n",
       "      <td>0.139466</td>\n",
       "      <td>-0.074121</td>\n",
       "      <td>-0.196884</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>0.043159</td>\n",
       "      <td>0.060647</td>\n",
       "      <td>0.016026</td>\n",
       "      <td>0.005236</td>\n",
       "      <td>0.019374</td>\n",
       "      <td>-0.188307</td>\n",
       "      <td>0.143595</td>\n",
       "      <td>0.126086</td>\n",
       "      <td>-0.141133</td>\n",
       "      <td>0.039357</td>\n",
       "      <td>0.012209</td>\n",
       "      <td>0.014843</td>\n",
       "      <td>0.011680</td>\n",
       "      <td>0.666280</td>\n",
       "      <td>-0.675011</td>\n",
       "      <td>-0.016761</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          0         1         2         3         4         5         6   \\\n",
       "0  -0.222742  0.263311 -0.354324  0.201683 -0.104739  0.393294  0.422638   \n",
       "1  -0.176182  0.264489 -0.113884  0.138779  0.255222 -0.076576 -0.145124   \n",
       "2   0.035115  0.371731  0.122479 -0.090039  0.359309  0.196599  0.050196   \n",
       "3   0.145043 -0.114328  0.010787 -0.022730  0.069970 -0.267264 -0.078085   \n",
       "4   0.553570 -0.119346  0.414334  0.270975 -0.021542  0.071159  0.067682   \n",
       "5   0.163904  0.208568 -0.055769  0.166646  0.630398 -0.084256 -0.115130   \n",
       "6   0.365585 -0.052028  0.078648 -0.087867  0.051706  0.065798  0.109443   \n",
       "7  -0.265292 -0.279226  0.006281  0.658992 -0.181603 -0.010895 -0.189539   \n",
       "8  -0.260557  0.114002  0.184736 -0.514467 -0.118458  0.006525 -0.093250   \n",
       "9   0.039571 -0.005249  0.117088 -0.231484 -0.297357 -0.123173 -0.064410   \n",
       "10  0.229190  0.369807  0.186680  0.122171 -0.328840  0.235760  0.282023   \n",
       "11 -0.036390 -0.638793 -0.067746 -0.205118  0.325155  0.465504  0.256466   \n",
       "12 -0.352690  0.055647  0.669917  0.084548  0.103422  0.320851 -0.078004   \n",
       "13  0.043159  0.060647  0.016026  0.005236  0.019374 -0.188307  0.143595   \n",
       "\n",
       "          7         8         9         10        11        12        13  \\\n",
       "0   0.399707  0.344365  0.199209  0.161564  0.024391 -0.007817  0.075389   \n",
       "1  -0.186183 -0.187085  0.005605 -0.060720  0.174841  0.062611  0.572606   \n",
       "2  -0.139835 -0.191900  0.303063 -0.086435  0.464752  0.363850 -0.293949   \n",
       "3   0.237171  0.337363 -0.364178  0.459535  0.384470  0.459891  0.026564   \n",
       "4   0.067230  0.081974  0.203411  0.014358 -0.091487  0.033391  0.157431   \n",
       "5  -0.009862  0.103554  0.013371  0.428871 -0.210514 -0.458194 -0.123691   \n",
       "6   0.116339  0.064194  0.446661 -0.055199 -0.137450  0.193075  0.096424   \n",
       "7  -0.228418 -0.142294  0.329392  0.325918  0.064108  0.143243 -0.070112   \n",
       "8  -0.117852 -0.031030  0.280630  0.520935 -0.379582  0.203918  0.091311   \n",
       "9   0.011790  0.075488  0.310984  0.169668  0.599610 -0.569295  0.044760   \n",
       "10 -0.140312 -0.417206 -0.404072  0.329369  0.011250 -0.061243 -0.032764   \n",
       "11 -0.075083 -0.236228 -0.094371  0.183414  0.155599 -0.077864  0.138497   \n",
       "12 -0.062740  0.417550 -0.182148 -0.123814  0.028249 -0.074508  0.139466   \n",
       "13  0.126086 -0.141133  0.039357  0.012209  0.014843  0.011680  0.666280   \n",
       "\n",
       "          14        15  \n",
       "0   0.068689  0.123937  \n",
       "1   0.582067  0.012661  \n",
       "2  -0.242831  0.133229  \n",
       "3   0.064236 -0.069460  \n",
       "4   0.178319  0.552467  \n",
       "5  -0.101349 -0.078992  \n",
       "6   0.172967 -0.717746  \n",
       "7  -0.129384 -0.122030  \n",
       "8   0.059847  0.187024  \n",
       "9   0.071209 -0.036481  \n",
       "10  0.053543 -0.210616  \n",
       "11  0.042510  0.022637  \n",
       "12 -0.074121 -0.196884  \n",
       "13 -0.675011 -0.016761  "
      ]
     },
     "execution_count": 110,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "components=pca.components_   #14个新特征的特征向量(每一行) \n",
    "components=pd.DataFrame(components) \n",
    "components"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 111,
   "id": "f476176c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0.2524355 , 0.12934125, 0.0891994 , 0.08255682, 0.07232587,\n",
       "       0.06844881, 0.05650669, 0.05073909, 0.05063498, 0.04080831,\n",
       "       0.03431659, 0.0232422 , 0.01804316, 0.01314993])"
      ]
     },
     "execution_count": 111,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pca.explained_variance_ratio_ #主成分的解释方差百分比"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "bf978974",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 重新划分训练集和测试集\n",
    "Xtrain,Xtest,Ytrain,Ytest=train_test_split(X_pca,Y, test_size=0.3, random_state=1) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6f55306e",
   "metadata": {},
   "outputs": [],
   "source": [
    "# # 实例化并训练模型\n",
    "lr=LinearRegression().fit(Xtrain,Ytrain) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "567ce7a8",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 模型在训练集和测试机上的评分（R²）\n",
    "lr.score(Xtrain,Ytrain),lr.score(Xtest,Ytest)  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "bf371f48",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 使用集成算法-随机森林回归器\n",
    "# 使用网格搜索寻找主要参数的最优取值组合\n",
    "from sklearn.ensemble import RandomForestRegressor\n",
    "from sklearn.model_selection import GridSearchCV\n",
    "\n",
    "rfr=RandomForestRegressor()  # 默认criterion='mse' (但如果使用score接口，返回的是R²，并不是MSE) \n",
    "\n",
    "test_param={'n_estimators':range(1,200,10),   \n",
    "          'max_depth':range(1,10)}  \n",
    "\n",
    "GS=GridSearchCV(estimator=rfr,param_grid=test_param,n_jobs=1,cv=5)   \n",
    "\n",
    "GS.fit(Xtrain,Ytrain)  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "3e36b740",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 查看最优参数组合\n",
    "GS.best_params_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "1342d1ba",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 用上面得到的最优参数组合重新实例化模型\n",
    "rfr=RandomForestRegressor(n_estimators=181,\n",
    "                         max_depth=9,).fit(Xtrain,Ytrain)   "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "618bf7d9",
   "metadata": {},
   "outputs": [],
   "source": [
    "rfr.score(Xtrain,Ytrain),rfr.score(Xtest,Ytest)   # 随机森林回归算法的score返回的是R²，并不是mse(尽管实例化时用的criterion='mse') "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "bbcee60a",
   "metadata": {},
   "outputs": [],
   "source": [
    "# # 使用交叉验证\n",
    "from sklearn.model_selection import cross_val_score\n",
    "score = cross_val_score(rfr,Xtest,Ytest,cv=5, scoring='neg_mean_squared_error').mean()  # 随机森林回归器在测试机上的MSE平均得分\n",
    "score"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d6447090",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.1"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {
    "height": "calc(100% - 180px)",
    "left": "10px",
    "top": "150px",
    "width": "384px"
   },
   "toc_section_display": true,
   "toc_window_display": true
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
